ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 $activeRecord)
 
static printStats ()
 
static get (string $class, string $id)
 
static purge (ActiveRecord $activeRecord)
 
static flush ($class_name)
 

Static Protected Attributes

static array $cache = []
 

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

89 : void
90 {
91 new $class_name();
92
93 if ($class_name instanceof ActiveRecord) {
94 $class_name = $class_name::class;
95 }
96 unset(self::$cache[$class_name]);
97 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ get()

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

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

72 {
73 new $class();
74 if (!self::isCached($class, $id)) {
75 throw new arException(arException::GET_UNCACHED_OBJECT, $class . ': ' . $id);
76 }
77
78 return self::$cache[$class][$id];
79 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const GET_UNCACHED_OBJECT

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

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

32 : bool
33 {
34 new $class();
35
36 if (!isset(self::$cache[$class])) {
37 return false;
38 }
39 if (!isset(self::$cache[$class][$id])) {
40 return false;
41 }
42 if (!self::$cache[$class][$id] instanceof ActiveRecord) {
43 return false;
44 }
45
46 return array_key_exists($id, self::$cache[$class]);
47 }

References $id.

Referenced by ActiveRecord\buildFromArray().

+ Here is the caller graph for this function:

◆ printStats()

static arObjectCache::printStats ( )
static

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

56 : void
57 {
58 foreach (self::$cache as $class => $objects) {
59 echo $class;
60 echo ": ";
61 echo is_countable($objects) ? count($objects) : 0;
62 echo " Objects<br>";
63 }
64 }

◆ purge()

static arObjectCache::purge ( ActiveRecord  $activeRecord)
static

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

81 : void
82 {
83 unset(self::$cache[$activeRecord::class][$activeRecord->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  $activeRecord)
static

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

49 : void
50 {
51 if (!isset($activeRecord->is_new)) {
52 self::$cache[$activeRecord::class][$activeRecord->getPrimaryFieldValue()] = $activeRecord;
53 }
54 }

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

array arObjectCache::$cache = []
staticprotected

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


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