ILIAS  release_8 Revision v8.24
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.

31 {
34 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(?string $component)

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

+ Here is the call graph for this function:

Member Function Documentation

◆ affectedRows()

arConnectorCache::affectedRows ( ActiveRecordList  $arl)

Reimplemented from arConnector.

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

141 : int
142 {
143 return $this->arConnectorDB->affectedRows($arl);
144 }
affectedRows(ActiveRecordList $activeRecordList)

References arConnectorDB\affectedRows().

+ Here is the call graph for this function:

◆ checkConnection()

arConnectorCache::checkConnection ( ActiveRecord  $ar)

Reimplemented from arConnector.

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

44 : bool
45 {
46 return $this->arConnectorDB->checkConnection($ar);
47 }
checkConnection(ActiveRecord $activeRecord)

References arConnectorDB\checkConnection().

+ Here is the call graph for this function:

◆ checkFieldExists()

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

Reimplemented from arConnector.

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

74 : bool
75 {
76 return $this->arConnectorDB->checkFieldExists($ar, $field_name);
77 }
checkFieldExists(ActiveRecord $activeRecord, string $field_name)

References arConnectorDB\checkFieldExists().

+ Here is the call graph for this function:

◆ checkTableExists()

arConnectorCache::checkTableExists ( ActiveRecord  $ar)

Reimplemented from arConnector.

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

69 : bool
70 {
71 return $this->arConnectorDB->checkTableExists($ar);
72 }
checkTableExists(ActiveRecord $activeRecord)

References arConnectorDB\checkTableExists().

+ Here is the call graph for this function:

◆ create()

arConnectorCache::create ( ActiveRecord  $ar)

Reimplemented from arConnector.

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

89 : void
90 {
91 $this->arConnectorDB->create($ar);
92 $this->storeActiveRecordInCache($ar);
93 }
storeActiveRecordInCache(ActiveRecord $ar)
Stores an active record into the Cache.
create(ActiveRecord $activeRecord)

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

+ Here is the call graph for this function:

◆ delete()

arConnectorCache::delete ( ActiveRecord  $ar)

Reimplemented from arConnector.

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

126 : void
127 {
128 $this->arConnectorDB->delete($ar);
129
130 if ($this->cache->isActive()) {
132 $this->cache->delete($key);
133 }
134 }
getConnectorContainerName()
@description Return the Name of your Connector Table
delete(ActiveRecord $activeRecord)
string $key
Consumer key/client ID value.
Definition: System.php:193

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

+ Here is the call graph for this function:

◆ installDatabase()

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

Reimplemented from arConnector.

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

49 : bool
50 {
51 return $this->arConnectorDB->installDatabase($ar, $fields);
52 }
installDatabase(ActiveRecord $activeRecord, array $fields)

References arConnectorDB\installDatabase().

+ Here is the call graph for this function:

◆ nextID()

arConnectorCache::nextID ( ActiveRecord  $ar)
Returns
mixed

Reimplemented from arConnector.

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

40 {
41 return $this->arConnectorDB->nextID($ar);
42 }
nextID(ActiveRecord $activeRecord)

References arConnectorDB\nextID().

+ Here is the call graph for this function:

◆ quote()

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

Reimplemented from arConnector.

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

149 : string
150 {
151 return $this->arConnectorDB->quote($value, $type);
152 }
quote($value, string $type)
$type

References $type, and arConnectorDB\quote().

+ Here is the call graph for this function:

◆ read()

arConnectorCache::read ( ActiveRecord  $ar)

Reimplemented from arConnector.

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

95 : array
96 {
97 if ($this->cache->isActive()) {
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()) {
113
114 $this->cache->set($key, $results, self::CACHE_TTL_SECONDS);
115 }
116
117 return $results;
118 }
read(ActiveRecord $activeRecord)
$results

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

+ Here is the call graph for this function:

◆ readSet()

arConnectorCache::readSet ( ActiveRecordList  $arl)

Reimplemented from arConnector.

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

136 : array
137 {
138 return $this->arConnectorDB->readSet($arl);
139 }
readSet(ActiveRecordList $activeRecordList)

References arConnectorDB\readSet().

+ Here is the call graph for this function:

◆ removeField()

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

Reimplemented from arConnector.

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

79 : bool
80 {
81 return $this->arConnectorDB->removeField($ar, $field_name);
82 }
removeField(ActiveRecord $activeRecord, string $field_name)

References arConnectorDB\removeField().

+ Here is the call graph for this function:

◆ renameField()

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

Reimplemented from arConnector.

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

84 : bool
85 {
86 return $this->arConnectorDB->renameField($ar, $old_name, $new_name);
87 }
renameField(ActiveRecord $activeRecord, string $old_name, string $new_name)

References arConnectorDB\renameField().

+ Here is the call graph for this function:

◆ resetDatabase()

arConnectorCache::resetDatabase ( ActiveRecord  $ar)

Reimplemented from arConnector.

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

59 : bool
60 {
61 return $this->arConnectorDB->resetDatabase($ar);
62 }
resetDatabase(ActiveRecord $activeRecord)

References arConnectorDB\resetDatabase().

+ 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.

162 : void
163 {
164 if ($this->cache->isActive()) {
166 $value = $ar->asStdClass();
167
168 $this->cache->set($key, $value, self::CACHE_TTL_SECONDS);
169 }
170 }

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

Referenced by create(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ truncateDatabase()

arConnectorCache::truncateDatabase ( ActiveRecord  $ar)

Reimplemented from arConnector.

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

64 : bool
65 {
66 return $this->arConnectorDB->truncateDatabase($ar);
67 }
truncateDatabase(ActiveRecord $activeRecord)

References arConnectorDB\truncateDatabase().

+ Here is the call graph for this function:

◆ update()

arConnectorCache::update ( ActiveRecord  $ar)

Reimplemented from arConnector.

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

120 : void
121 {
122 $this->arConnectorDB->update($ar);
123 $this->storeActiveRecordInCache($ar);
124 }
update(ActiveRecord $activeRecord)

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

+ Here is the call graph for this function:

◆ updateDatabase()

arConnectorCache::updateDatabase ( ActiveRecord  $ar)

Reimplemented from arConnector.

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

54 : bool
55 {
56 return $this->arConnectorDB->updateDatabase($ar);
57 }
updateDatabase(ActiveRecord $activeRecord)

References arConnectorDB\updateDatabase().

+ Here is the call graph for this function:

◆ updateIndices()

arConnectorCache::updateIndices ( ActiveRecord  $ar)

Reimplemented from arConnector.

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

154 : void
155 {
156 $this->arConnectorDB->updateIndices($ar);
157 }
updateIndices(ActiveRecord $activeRecord)

References arConnectorDB\updateIndices().

+ 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: