ILIAS  release_8 Revision v8.23
arObjectCache Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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 array $cache = array()
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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 24 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.

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

84  : void
85  {
86  if ($class_name instanceof ActiveRecord) {
87  $class_name = get_class($class_name);
88  }
89  unset(self::$cache[$class_name]);
90  }
+ Here is the caller graph for this function:

◆ get()

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

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

References $id, and arException\GET_UNCACHED_OBJECT.

Referenced by ActiveRecord\additionalParams(), and ActiveRecord\buildFromArray().

67  {
68  $instance = new $class();
69  if (!self::isCached($class, $id)) {
70  throw new arException(arException::GET_UNCACHED_OBJECT, $class . ': ' . $id);
71  }
72 
73  return self::$cache[$class][$id];
74  }
Class ActiveRecord.
const GET_UNCACHED_OBJECT
Class arException.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the caller graph for this function:

◆ isCached()

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

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

References $id.

Referenced by ActiveRecord\additionalParams(), and ActiveRecord\buildFromArray().

32  : bool
33  {
34  if (!isset(self::$cache[$class])) {
35  return false;
36  }
37  if (!isset(self::$cache[$class][$id]) || !self::$cache[$class][$id] instanceof ActiveRecord) {
38  return false;
39  }
40 
41  return array_key_exists($id, self::$cache[$class]);
42  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the caller graph for this function:

◆ printStats()

static arObjectCache::printStats ( )
static

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

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

◆ purge()

static arObjectCache::purge ( ActiveRecord  $object)
static

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

References ActiveRecord\getPrimaryFieldValue().

Referenced by ActiveRecord\delete().

76  : void
77  {
78  unset(self::$cache[get_class($object)][$object->getPrimaryFieldValue()]);
79  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ store()

static arObjectCache::store ( ActiveRecord  $object)
static

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

References ActiveRecord\getPrimaryFieldValue().

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

44  : void
45  {
46  if (!isset($object->is_new)) {
47  self::$cache[get_class($object)][$object->getPrimaryFieldValue()] = $object;
48  }
49  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $cache

array arObjectCache::$cache = array()
staticprotected

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


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