ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
arConnectorCache Class Reference

Class ilGSStorageCache. More...

+ Inheritance diagram for arConnectorCache:
+ Collaboration diagram for arConnectorCache:

Public Member Functions

 __construct (arConnector $arConnectorDB)
 ilGSStorageCache constructor. More...
 
 nextID (ActiveRecord $ar)
 
 checkConnection (ActiveRecord $ar)
 
 installDatabase (ActiveRecord $ar, array $fields)
 
 updateDatabase (ActiveRecord $ar)
 
 resetDatabase (ActiveRecord $ar)
 
 truncateDatabase (ActiveRecord $ar)
 
 checkTableExists (ActiveRecord $ar)
 
 checkFieldExists (ActiveRecord $ar, string $field_name)
 
 removeField (ActiveRecord $ar, string $field_name)
 
 renameField (ActiveRecord $ar, string $old_name, string $new_name)
 
 create (ActiveRecord $ar)
 
 read (ActiveRecord $ar)
 
 update (ActiveRecord $ar)
 
 delete (ActiveRecord $ar)
 
 readSet (ActiveRecordList $arl)
 
 affectedRows (ActiveRecordList $arl)
 
 quote ($value, string $type)
 
 updateIndices (ActiveRecord $ar)
 
- Public Member Functions inherited from arConnector
 nextID (ActiveRecord $ar)
 
 checkConnection (ActiveRecord $ar)
 
 installDatabase (ActiveRecord $ar, array $fields)
 
 updateDatabase (ActiveRecord $ar)
 
 resetDatabase (ActiveRecord $ar)
 
 truncateDatabase (ActiveRecord $ar)
 
 checkTableExists (ActiveRecord $ar)
 
 checkFieldExists (ActiveRecord $ar, string $field_name)
 
 removeField (ActiveRecord $ar, string $field_name)
 
 renameField (ActiveRecord $ar, string $old_name, string $new_name)
 
 create (ActiveRecord $ar)
 
 read (ActiveRecord $ar)
 
 update (ActiveRecord $ar)
 
 delete (ActiveRecord $ar)
 
 readSet (ActiveRecordList $arl)
 
 affectedRows (ActiveRecordList $arl)
 
 quote ($value, string $type)
 
 updateIndices (ActiveRecord $ar)
 
 fixDate (string $value)
 

Data Fields

const CACHE_TTL_SECONDS = 180
 

Private Member Functions

 storeActiveRecordInCache (ActiveRecord $ar)
 Stores an active record into the Cache. More...
 

Private Attributes

arConnector $arConnectorDB
 
ilGlobalCache $cache
 

Detailed Description

Class ilGSStorageCache.

Author
Nicolas Schäfli ns@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 20 of file class.arConnectorCache.php.

Constructor & Destructor Documentation

◆ __construct()

arConnectorCache::__construct ( arConnector  $arConnectorDB)

ilGSStorageCache constructor.

Parameters
int$ttl

Definition at line 30 of file class.arConnectorCache.php.

References $arConnectorDB, ilGlobalCache\COMP_GLOBAL_SCREEN, and ilGlobalCache\getInstance().

31  {
34  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(?string $component)
+ Here is the call graph for this function:

Member Function Documentation

◆ affectedRows()

arConnectorCache::affectedRows ( ActiveRecordList  $arl)

Definition at line 141 of file class.arConnectorCache.php.

References arConnectorDB\affectedRows().

141  : int
142  {
143  return $this->arConnectorDB->affectedRows($arl);
144  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
affectedRows(ActiveRecordList $activeRecordList)
+ Here is the call graph for this function:

◆ checkConnection()

arConnectorCache::checkConnection ( ActiveRecord  $ar)

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

References arConnectorDB\checkConnection().

44  : bool
45  {
46  return $this->arConnectorDB->checkConnection($ar);
47  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkConnection(ActiveRecord $activeRecord)
+ Here is the call graph for this function:

◆ checkFieldExists()

arConnectorCache::checkFieldExists ( ActiveRecord  $ar,
string  $field_name 
)

Definition at line 74 of file class.arConnectorCache.php.

References arConnectorDB\checkFieldExists().

74  : bool
75  {
76  return $this->arConnectorDB->checkFieldExists($ar, $field_name);
77  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkFieldExists(ActiveRecord $activeRecord, string $field_name)
+ Here is the call graph for this function:

◆ checkTableExists()

arConnectorCache::checkTableExists ( ActiveRecord  $ar)

Definition at line 69 of file class.arConnectorCache.php.

References arConnectorDB\checkTableExists().

69  : bool
70  {
71  return $this->arConnectorDB->checkTableExists($ar);
72  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkTableExists(ActiveRecord $activeRecord)
+ Here is the call graph for this function:

◆ create()

arConnectorCache::create ( ActiveRecord  $ar)

Definition at line 89 of file class.arConnectorCache.php.

References arConnectorDB\create(), and storeActiveRecordInCache().

89  : void
90  {
91  $this->arConnectorDB->create($ar);
92  $this->storeActiveRecordInCache($ar);
93  }
create(ActiveRecord $activeRecord)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
storeActiveRecordInCache(ActiveRecord $ar)
Stores an active record into the Cache.
+ Here is the call graph for this function:

◆ delete()

arConnectorCache::delete ( ActiveRecord  $ar)

Definition at line 126 of file class.arConnectorCache.php.

References ILIAS\LTI\ToolProvider\$key, and arConnectorDB\delete().

126  : void
127  {
128  $this->arConnectorDB->delete($ar);
129 
130  if ($this->cache->isActive()) {
131  $key = $ar->getConnectorContainerName() . "_" . $ar->getPrimaryFieldValue();
132  $this->cache->delete($key);
133  }
134  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getConnectorContainerName()
Return the Name of your Connector Table
string $key
Consumer key/client ID value.
Definition: System.php:193
delete(ActiveRecord $activeRecord)
+ Here is the call graph for this function:

◆ installDatabase()

arConnectorCache::installDatabase ( ActiveRecord  $ar,
array  $fields 
)

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

References arConnectorDB\installDatabase().

49  : bool
50  {
51  return $this->arConnectorDB->installDatabase($ar, $fields);
52  }
installDatabase(ActiveRecord $activeRecord, array $fields)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ nextID()

arConnectorCache::nextID ( ActiveRecord  $ar)
Returns
mixed

Definition at line 39 of file class.arConnectorCache.php.

References arConnectorDB\nextID().

40  {
41  return $this->arConnectorDB->nextID($ar);
42  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
nextID(ActiveRecord $activeRecord)
+ Here is the call graph for this function:

◆ quote()

arConnectorCache::quote (   $value,
string  $type 
)
Parameters
$value

Definition at line 149 of file class.arConnectorCache.php.

References arConnectorDB\quote().

149  : string
150  {
151  return $this->arConnectorDB->quote($value, $type);
152  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$type
quote($value, string $type)
+ Here is the call graph for this function:

◆ read()

arConnectorCache::read ( ActiveRecord  $ar)

Definition at line 95 of file class.arConnectorCache.php.

References ILIAS\LTI\ToolProvider\$key, $results, ActiveRecord\getConnectorContainerName(), ActiveRecord\getPrimaryFieldValue(), and arConnectorDB\read().

95  : array
96  {
97  if ($this->cache->isActive()) {
98  $key = $ar->getConnectorContainerName() . "_" . $ar->getPrimaryFieldValue();
99  $cached_value = $this->cache->get($key);
100  if (is_array($cached_value)) {
101  return $cached_value;
102  }
103 
104  if ($cached_value instanceof stdClass) {
105  return [$cached_value];
106  }
107  }
108 
109  $results = $this->arConnectorDB->read($ar);
110 
111  if ($this->cache->isActive()) {
112  $key = $ar->getConnectorContainerName() . "_" . $ar->getPrimaryFieldValue();
113 
114  $this->cache->set($key, $results, self::CACHE_TTL_SECONDS);
115  }
116 
117  return $results;
118  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getConnectorContainerName()
Return the Name of your Connector Table
string $key
Consumer key/client ID value.
Definition: System.php:193
$results
read(ActiveRecord $activeRecord)
+ Here is the call graph for this function:

◆ readSet()

arConnectorCache::readSet ( ActiveRecordList  $arl)

Definition at line 136 of file class.arConnectorCache.php.

References arConnectorDB\readSet().

136  : array
137  {
138  return $this->arConnectorDB->readSet($arl);
139  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
readSet(ActiveRecordList $activeRecordList)
+ Here is the call graph for this function:

◆ removeField()

arConnectorCache::removeField ( ActiveRecord  $ar,
string  $field_name 
)

Definition at line 79 of file class.arConnectorCache.php.

References arConnectorDB\removeField().

79  : bool
80  {
81  return $this->arConnectorDB->removeField($ar, $field_name);
82  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
removeField(ActiveRecord $activeRecord, string $field_name)
+ Here is the call graph for this function:

◆ renameField()

arConnectorCache::renameField ( ActiveRecord  $ar,
string  $old_name,
string  $new_name 
)

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

References arConnectorDB\renameField().

84  : bool
85  {
86  return $this->arConnectorDB->renameField($ar, $old_name, $new_name);
87  }
renameField(ActiveRecord $activeRecord, string $old_name, string $new_name)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ resetDatabase()

arConnectorCache::resetDatabase ( ActiveRecord  $ar)

Definition at line 59 of file class.arConnectorCache.php.

References arConnectorDB\resetDatabase().

59  : bool
60  {
61  return $this->arConnectorDB->resetDatabase($ar);
62  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
resetDatabase(ActiveRecord $activeRecord)
+ Here is the call graph for this function:

◆ storeActiveRecordInCache()

arConnectorCache::storeActiveRecordInCache ( ActiveRecord  $ar)
private

Stores an active record into the Cache.

Definition at line 162 of file class.arConnectorCache.php.

References ILIAS\LTI\ToolProvider\$key, ActiveRecord\asStdClass(), ActiveRecord\getConnectorContainerName(), and ActiveRecord\getPrimaryFieldValue().

Referenced by create(), and update().

162  : void
163  {
164  if ($this->cache->isActive()) {
165  $key = $ar->getConnectorContainerName() . "_" . $ar->getPrimaryFieldValue();
166  $value = $ar->asStdClass();
167 
168  $this->cache->set($key, $value, self::CACHE_TTL_SECONDS);
169  }
170  }
getConnectorContainerName()
Return the Name of your Connector Table
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ truncateDatabase()

arConnectorCache::truncateDatabase ( ActiveRecord  $ar)

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

References arConnectorDB\truncateDatabase().

64  : bool
65  {
66  return $this->arConnectorDB->truncateDatabase($ar);
67  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
truncateDatabase(ActiveRecord $activeRecord)
+ Here is the call graph for this function:

◆ update()

arConnectorCache::update ( ActiveRecord  $ar)

Definition at line 120 of file class.arConnectorCache.php.

References storeActiveRecordInCache(), and arConnectorDB\update().

120  : void
121  {
122  $this->arConnectorDB->update($ar);
123  $this->storeActiveRecordInCache($ar);
124  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
update(ActiveRecord $activeRecord)
storeActiveRecordInCache(ActiveRecord $ar)
Stores an active record into the Cache.
+ Here is the call graph for this function:

◆ updateDatabase()

arConnectorCache::updateDatabase ( ActiveRecord  $ar)

Definition at line 54 of file class.arConnectorCache.php.

References arConnectorDB\updateDatabase().

54  : bool
55  {
56  return $this->arConnectorDB->updateDatabase($ar);
57  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
updateDatabase(ActiveRecord $activeRecord)
+ Here is the call graph for this function:

◆ updateIndices()

arConnectorCache::updateIndices ( ActiveRecord  $ar)

Definition at line 154 of file class.arConnectorCache.php.

References arConnectorDB\updateIndices().

154  : void
155  {
156  $this->arConnectorDB->updateIndices($ar);
157  }
updateIndices(ActiveRecord $activeRecord)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

Field Documentation

◆ $arConnectorDB

arConnector arConnectorCache::$arConnectorDB
private

Definition at line 22 of file class.arConnectorCache.php.

Referenced by __construct().

◆ $cache

ilGlobalCache arConnectorCache::$cache
private

Definition at line 23 of file class.arConnectorCache.php.

◆ CACHE_TTL_SECONDS

const arConnectorCache::CACHE_TTL_SECONDS = 180

Definition at line 24 of file class.arConnectorCache.php.


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