ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
arConnectorCache Class Reference

Class ilGSStorageCache. More...

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

Public Member Functions

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

Data Fields

const CACHE_TTL_SECONDS = 180
 

Private Member Functions

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

Private Attributes

 $ttl
 
 $arConnectorDB
 
 $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 8 of file class.arConnectorCache.php.

Constructor & Destructor Documentation

◆ __construct()

arConnectorCache::__construct ( arConnector  $arConnectorDB,
int  $ttl = self::CACHE_TTL_SECONDS 
)

ilGSStorageCache constructor.

Parameters
arConnector$arConnectorDB
int$ttl

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

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

+ Here is the call graph for this function:

Member Function Documentation

◆ affectedRows()

arConnectorCache::affectedRows ( ActiveRecordList  $arl)
Parameters
ActiveRecordList$arl
Returns
int

Reimplemented from arConnector.

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

246 {
247 return $this->arConnectorDB->affectedRows($arl);
248 }
affectedRows(ActiveRecordList $arl)

References arConnectorDB\affectedRows().

+ Here is the call graph for this function:

◆ checkConnection()

arConnectorCache::checkConnection ( ActiveRecord  $ar)
Parameters
ActiveRecord$ar
Returns
mixed

Reimplemented from arConnector.

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

57 {
58 return $this->arConnectorDB->checkConnection($ar);
59 }
checkConnection(ActiveRecord $ar)

References arConnectorDB\checkConnection().

+ Here is the call graph for this function:

◆ checkFieldExists()

arConnectorCache::checkFieldExists ( ActiveRecord  $ar,
  $field_name 
)
Parameters
ActiveRecord$ar
$field_name
Returns
mixed

Reimplemented from arConnector.

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

126 {
127 return $this->arConnectorDB->checkFieldExists($ar, $field_name);
128 }
checkFieldExists(ActiveRecord $ar, $field_name)

References arConnectorDB\checkFieldExists().

+ Here is the call graph for this function:

◆ checkTableExists()

arConnectorCache::checkTableExists ( ActiveRecord  $ar)
Parameters
ActiveRecord$ar
Returns
mixed

Reimplemented from arConnector.

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

114 {
115 return $this->arConnectorDB->checkTableExists($ar);
116 }
checkTableExists(ActiveRecord $ar)

References arConnectorDB\checkTableExists().

+ Here is the call graph for this function:

◆ create()

arConnectorCache::create ( ActiveRecord  $ar)
Parameters
ActiveRecord$ar
Returns
void

Reimplemented from arConnector.

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

164 {
165 $this->arConnectorDB->create($ar);
166 $this->storeActiveRecordInCache($ar);
167 }
storeActiveRecordInCache(ActiveRecord $ar)
Stores an active record into the Cache.
create(ActiveRecord $ar)

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

+ Here is the call graph for this function:

◆ delete()

arConnectorCache::delete ( ActiveRecord  $ar)
Parameters
ActiveRecord$ar
Returns
void

Reimplemented from arConnector.

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

219 {
220 $this->arConnectorDB->delete($ar);
221
222 if ($this->cache->isActive()) {
224 $this->cache->delete($key);
225 }
226 }
delete(ActiveRecord $ar)
$key
Definition: croninfo.php:18

References $key, and arConnectorDB\delete().

+ Here is the call graph for this function:

◆ installDatabase()

arConnectorCache::installDatabase ( ActiveRecord  $ar,
  $fields 
)
Parameters
ActiveRecord$ar
$fields
Returns
bool

Reimplemented from arConnector.

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

69 {
70 return $this->arConnectorDB->installDatabase($ar, $fields);
71 }
installDatabase(ActiveRecord $ar, $fields)

References arConnectorDB\installDatabase().

+ Here is the call graph for this function:

◆ nextID()

arConnectorCache::nextID ( ActiveRecord  $ar)
Parameters
ActiveRecord$ar
Returns
mixed

Reimplemented from arConnector.

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

46 {
47 return $this->arConnectorDB->nextID($ar);
48 }
nextID(ActiveRecord $ar)

References arConnectorDB\nextID().

+ Here is the call graph for this function:

◆ quote()

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

Reimplemented from arConnector.

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

258 {
259 return $this->arConnectorDB->quote($value, $type);
260 }
quote($value, $type)
$type

References $type, and arConnectorDB\quote().

+ Here is the call graph for this function:

◆ read()

arConnectorCache::read ( ActiveRecord  $ar)
Parameters
ActiveRecord$ar
Returns
array

Reimplemented from arConnector.

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

176 {
177 if ($this->cache->isActive()) {
179 $cached_value = $this->cache->get($key);
180 if (is_array($cached_value)) {
181 return $cached_value;
182 }
183
184 if ($cached_value instanceof stdClass) {
185 return [$cached_value];
186 }
187 }
188
189 $results = $this->arConnectorDB->read($ar);
190
191 if ($this->cache->isActive()) {
193
194 $this->cache->set($key, $results, self::CACHE_TTL_SECONDS);
195 }
196
197 return $results;
198 }
read(ActiveRecord $ar)
$results
Definition: svg-scanner.php:47

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

+ Here is the call graph for this function:

◆ readSet()

arConnectorCache::readSet ( ActiveRecordList  $arl)
Parameters
ActiveRecordList$arl
Returns
mixed

Reimplemented from arConnector.

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

235 {
236 return $this->arConnectorDB->readSet($arl);
237 }
readSet(ActiveRecordList $arl)

References arConnectorDB\readSet().

+ Here is the call graph for this function:

◆ removeField()

arConnectorCache::removeField ( ActiveRecord  $ar,
  $field_name 
)
Parameters
ActiveRecord$ar
$field_name
Returns
bool
Exceptions
arException

Reimplemented from arConnector.

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

139 {
140 return $this->arConnectorDB->removeField($ar, $field_name);
141 }
removeField(ActiveRecord $ar, $field_name)

References arConnectorDB\removeField().

+ Here is the call graph for this function:

◆ renameField()

arConnectorCache::renameField ( ActiveRecord  $ar,
  $old_name,
  $new_name 
)
Parameters
ActiveRecord$ar
$old_name
$new_name
Returns
bool
Exceptions
arException

Reimplemented from arConnector.

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

153 {
154 return $this->arConnectorDB->renameField($ar, $old_name, $new_name);
155 }
renameField(ActiveRecord $ar, $old_name, $new_name)

References arConnectorDB\renameField().

+ Here is the call graph for this function:

◆ resetDatabase()

arConnectorCache::resetDatabase ( ActiveRecord  $ar)
Parameters
ActiveRecord$ar
Returns
true

Reimplemented from arConnector.

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

91 {
92 return $this->arConnectorDB->resetDatabase($ar);
93 }
resetDatabase(ActiveRecord $ar)

References arConnectorDB\resetDatabase().

+ Here is the call graph for this function:

◆ storeActiveRecordInCache()

arConnectorCache::storeActiveRecordInCache ( ActiveRecord  $ar)
private

Stores an active record into the Cache.

Parameters
ActiveRecord$ar
Returns
void

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

280 {
281 if ($this->cache->isActive()) {
283 $value = $ar->__asStdClass();
284
285 $this->cache->set($key, $value, self::CACHE_TTL_SECONDS);
286 }
287 }

References $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)
Parameters
ActiveRecord$ar
Returns
void

Reimplemented from arConnector.

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

102 {
103 $this->arConnectorDB->truncateDatabase($ar);
104 }
truncateDatabase(ActiveRecord $ar)

References arConnectorDB\truncateDatabase().

+ Here is the call graph for this function:

◆ update()

arConnectorCache::update ( ActiveRecord  $ar)
Parameters
ActiveRecord$ar
Returns
void

Reimplemented from arConnector.

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

207 {
208 $this->arConnectorDB->update($ar);
209 $this->storeActiveRecordInCache($ar);
210 }
update(ActiveRecord $ar)

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

+ Here is the call graph for this function:

◆ updateDatabase()

arConnectorCache::updateDatabase ( ActiveRecord  $ar)
Parameters
ActiveRecord$ar
Returns
bool

Reimplemented from arConnector.

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

80 {
81 return $this->arConnectorDB->updateDatabase($ar);
82 }
updateDatabase(ActiveRecord $ar)

References arConnectorDB\updateDatabase().

+ Here is the call graph for this function:

◆ updateIndices()

arConnectorCache::updateIndices ( ActiveRecord  $ar)
Parameters
ActiveRecord$ar

Reimplemented from arConnector.

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

267 {
268 $this->arConnectorDB->updateIndices($ar);
269 }
updateIndices(ActiveRecord $ar)

References arConnectorDB\updateIndices().

+ Here is the call graph for this function:

Field Documentation

◆ $arConnectorDB

arConnectorCache::$arConnectorDB
private

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

Referenced by __construct().

◆ $cache

arConnectorCache::$cache
private

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

◆ $ttl

arConnectorCache::$ttl
private

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

Referenced by __construct().

◆ CACHE_TTL_SECONDS

const arConnectorCache::CACHE_TTL_SECONDS = 180

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


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