ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
arObjectCache Class Reference

Class arObjectCache. More...

+ Collaboration diagram for arObjectCache:

Static Public Member Functions

static isCached ($class, $id)
 
static store (ActiveRecord $object)
 
static printStats ()
 
static get ($class, $id)
 
static purge (ActiveRecord $object)
 
static flush ($class_name)
 

Static Protected Attributes

static $cache = array()
 

Detailed Description

Class arObjectCache.

Version
2.0.7
Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 11 of file class.arObjectCache.php.

Member Function Documentation

◆ flush()

static arObjectCache::flush (   $class_name)
static
Parameters
$class_name

Definition at line 84 of file class.arObjectCache.php.

84 {
85 if ($class_name instanceof ActiveRecord) {
86 $class_name = get_class($class_name);
87 }
88 unset(self::$cache[$class_name]);
89 }
Class ActiveRecord.

◆ get()

static arObjectCache::get (   $class,
  $id 
)
static
Parameters
$class
$id
Exceptions
arException
Returns
ActiveRecord

Definition at line 64 of file class.arObjectCache.php.

64 {
65 if (!self::isCached($class, $id)) {
66 throw new arException(arException::GET_UNCACHED_OBJECT, $class . ': ' . $id);
67 }
68
69 return self::$cache[$class][$id];
70 }
Class arException.
const GET_UNCACHED_OBJECT

References arException\GET_UNCACHED_OBJECT.

Referenced by ActiveRecord\buildFromArray().

+ Here is the caller graph for this function:

◆ isCached()

static arObjectCache::isCached (   $class,
  $id 
)
static
Parameters
$class
$id
Returns
bool

Definition at line 25 of file class.arObjectCache.php.

25 {
26 if (!isset(self::$cache[$class])) {
27 return false;
28 }
29 if (!isset(self::$cache[$class][$id]) || !self::$cache[$class][$id] instanceof ActiveRecord) {
30 return false;
31 }
32
33 return in_array($id, array_keys(self::$cache[$class]));
34 }

Referenced by ActiveRecord\buildFromArray().

+ Here is the caller graph for this function:

◆ printStats()

static arObjectCache::printStats ( )
static

Definition at line 47 of file class.arObjectCache.php.

47 {
48 foreach (self::$cache as $class => $objects) {
49 echo $class;
50 echo ": ";
51 echo count($objects);
52 echo " Objects<br>";
53 }
54 }

◆ purge()

static arObjectCache::purge ( ActiveRecord  $object)
static
Parameters
ActiveRecord$object

Definition at line 76 of file class.arObjectCache.php.

76 {
77 unset(self::$cache[get_class($object)][$object->getPrimaryFieldValue()]);
78 }

References ActiveRecord\getPrimaryFieldValue().

Referenced by ActiveRecord\delete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ store()

static arObjectCache::store ( ActiveRecord  $object)
static
Parameters
ActiveRecord$object

Definition at line 40 of file class.arObjectCache.php.

40 {
41 if (!isset($object->is_new)) {
42 self::$cache[get_class($object)][$object->getPrimaryFieldValue()] = $object;
43 }
44 }

References ActiveRecord\getPrimaryFieldValue().

Referenced by ActiveRecord\buildFromArray(), ActiveRecord\create(), ActiveRecord\storeObjectToCache(), and ActiveRecord\update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $cache

arObjectCache::$cache = array()
staticprotected

Definition at line 16 of file class.arObjectCache.php.


The documentation for this class was generated from the following file: