ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 90 of file class.arObjectCache.php.

91 {
92 if ($class_name instanceof ActiveRecord) {
93 $class_name = get_class($class_name);
94 }
95 unset(self::$cache[$class_name]);
96 }
Class ActiveRecord.

Referenced by ilOrgUnitPosition\getActive(), and ilOrgUnitPosition\getActiveForPosition().

+ Here is the caller graph for this function:

◆ get()

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

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

69 {
70 if (!self::isCached($class, $id)) {
71 throw new arException(arException::GET_UNCACHED_OBJECT, $class . ': ' . $id);
72 }
73
74 return self::$cache[$class][$id];
75 }
Class arException.
const GET_UNCACHED_OBJECT
if(!array_key_exists('StateId', $_REQUEST)) $id

References $id, and 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 26 of file class.arObjectCache.php.

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

References $id.

Referenced by ActiveRecord\buildFromArray().

+ Here is the caller graph for this function:

◆ printStats()

static arObjectCache::printStats ( )
static

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

51 {
52 foreach (self::$cache as $class => $objects) {
53 echo $class;
54 echo ": ";
55 echo count($objects);
56 echo " Objects<br>";
57 }
58 }

◆ purge()

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

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

82 {
83 unset(self::$cache[get_class($object)][$object->getPrimaryFieldValue()]);
84 }

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 42 of file class.arObjectCache.php.

43 {
44 if (!isset($object->is_new)) {
45 self::$cache[get_class($object)][$object->getPrimaryFieldValue()] = $object;
46 }
47 }

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 17 of file class.arObjectCache.php.


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