ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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

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

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

{
if ($class_name instanceof ActiveRecord) {
$class_name = get_class($class_name);
}
unset(self::$cache[$class_name]);
}
static arObjectCache::get (   $class,
  $id 
)
static
Parameters
$class
$id
Exceptions
arException
Returns
ActiveRecord

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

References arException\GET_UNCACHED_OBJECT.

Referenced by ActiveRecord\buildFromArray().

{
if (!self::isCached($class, $id)) {
throw new arException(arException::GET_UNCACHED_OBJECT, $class . ': ' . $id);
}
return self::$cache[$class][$id];
}

+ Here is the caller graph for this function:

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

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

Referenced by ActiveRecord\buildFromArray().

{
if (!isset(self::$cache[$class])) {
return false;
}
if (!isset(self::$cache[$class][$id]) || !self::$cache[$class][$id] instanceof ActiveRecord) {
return false;
}
return in_array($id, array_keys(self::$cache[$class]));
}

+ Here is the caller graph for this function:

static arObjectCache::printStats ( )
static

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

{
foreach (self::$cache as $class => $objects) {
echo $class;
echo ": ";
echo count($objects);
echo " Objects<br>";
}
}
static arObjectCache::purge ( ActiveRecord  $object)
static
Parameters
ActiveRecord$object

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

References ActiveRecord\getPrimaryFieldValue().

Referenced by ActiveRecord\delete().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

References ActiveRecord\getPrimaryFieldValue().

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

arObjectCache::$cache = array()
staticprotected

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


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