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().

33  {
34  $this->ttl = $ttl;
37  }
Class arConnectorDB.
static getInstance($component)
+ Here is the call graph for this function:

Member Function Documentation

◆ affectedRows()

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

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

References arConnectorDB\affectedRows().

246  {
247  return $this->arConnectorDB->affectedRows($arl);
248  }
Class arConnectorDB.
affectedRows(ActiveRecordList $arl)
+ Here is the call graph for this function:

◆ checkConnection()

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

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

References arConnectorDB\checkConnection().

57  {
58  return $this->arConnectorDB->checkConnection($ar);
59  }
Class arConnectorDB.
checkConnection(ActiveRecord $ar)
+ Here is the call graph for this function:

◆ checkFieldExists()

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

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

References arConnectorDB\checkFieldExists().

126  {
127  return $this->arConnectorDB->checkFieldExists($ar, $field_name);
128  }
Class arConnectorDB.
checkFieldExists(ActiveRecord $ar, $field_name)
+ Here is the call graph for this function:

◆ checkTableExists()

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

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

References arConnectorDB\checkTableExists().

114  {
115  return $this->arConnectorDB->checkTableExists($ar);
116  }
Class arConnectorDB.
checkTableExists(ActiveRecord $ar)
+ Here is the call graph for this function:

◆ create()

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

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

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

164  {
165  $this->arConnectorDB->create($ar);
166  $this->storeActiveRecordInCache($ar);
167  }
Class arConnectorDB.
storeActiveRecordInCache(ActiveRecord $ar)
Stores an active record into the Cache.
create(ActiveRecord $ar)
+ Here is the call graph for this function:

◆ delete()

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

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

References $key, and arConnectorDB\delete().

219  {
220  $this->arConnectorDB->delete($ar);
221 
222  if ($this->cache->isActive()) {
223  $key = $ar->getConnectorContainerName() . "_" . $ar->getPrimaryFieldValue();
224  $this->cache->delete($key);
225  }
226  }
Class arConnectorDB.
delete(ActiveRecord $ar)
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:

◆ installDatabase()

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

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

References arConnectorDB\installDatabase().

69  {
70  return $this->arConnectorDB->installDatabase($ar, $fields);
71  }
Class arConnectorDB.
installDatabase(ActiveRecord $ar, $fields)
+ Here is the call graph for this function:

◆ nextID()

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

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

References arConnectorDB\nextID().

46  {
47  return $this->arConnectorDB->nextID($ar);
48  }
Class arConnectorDB.
nextID(ActiveRecord $ar)
+ Here is the call graph for this function:

◆ quote()

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

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

References $type, and arConnectorDB\quote().

258  {
259  return $this->arConnectorDB->quote($value, $type);
260  }
Class arConnectorDB.
$type
quote($value, $type)
+ Here is the call graph for this function:

◆ read()

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

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

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

176  {
177  if ($this->cache->isActive()) {
178  $key = $ar->getConnectorContainerName() . "_" . $ar->getPrimaryFieldValue();
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()) {
192  $key = $ar->getConnectorContainerName() . "_" . $ar->getPrimaryFieldValue();
193 
194  $this->cache->set($key, $results, self::CACHE_TTL_SECONDS);
195  }
196 
197  return $results;
198  }
read(ActiveRecord $ar)
Class arConnectorDB.
$results
Definition: svg-scanner.php:47
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:

◆ readSet()

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

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

References arConnectorDB\readSet().

235  {
236  return $this->arConnectorDB->readSet($arl);
237  }
Class arConnectorDB.
readSet(ActiveRecordList $arl)
+ Here is the call graph for this function:

◆ removeField()

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

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

References arConnectorDB\removeField().

139  {
140  return $this->arConnectorDB->removeField($ar, $field_name);
141  }
Class arConnectorDB.
removeField(ActiveRecord $ar, $field_name)
+ 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

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

References arConnectorDB\renameField().

153  {
154  return $this->arConnectorDB->renameField($ar, $old_name, $new_name);
155  }
Class arConnectorDB.
renameField(ActiveRecord $ar, $old_name, $new_name)
+ Here is the call graph for this function:

◆ resetDatabase()

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

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

References arConnectorDB\resetDatabase().

91  {
92  return $this->arConnectorDB->resetDatabase($ar);
93  }
Class arConnectorDB.
resetDatabase(ActiveRecord $ar)
+ 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.

References $key, ActiveRecord\__asStdClass(), ActiveRecord\getConnectorContainerName(), and ActiveRecord\getPrimaryFieldValue().

Referenced by create(), and update().

280  {
281  if ($this->cache->isActive()) {
282  $key = $ar->getConnectorContainerName() . "_" . $ar->getPrimaryFieldValue();
283  $value = $ar->__asStdClass();
284 
285  $this->cache->set($key, $value, self::CACHE_TTL_SECONDS);
286  }
287  }
$key
Definition: croninfo.php:18
+ 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

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

References arConnectorDB\truncateDatabase().

102  {
103  $this->arConnectorDB->truncateDatabase($ar);
104  }
Class arConnectorDB.
truncateDatabase(ActiveRecord $ar)
+ Here is the call graph for this function:

◆ update()

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

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

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

207  {
208  $this->arConnectorDB->update($ar);
209  $this->storeActiveRecordInCache($ar);
210  }
Class arConnectorDB.
update(ActiveRecord $ar)
storeActiveRecordInCache(ActiveRecord $ar)
Stores an active record into the Cache.
+ Here is the call graph for this function:

◆ updateDatabase()

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

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

References arConnectorDB\updateDatabase().

80  {
81  return $this->arConnectorDB->updateDatabase($ar);
82  }
Class arConnectorDB.
updateDatabase(ActiveRecord $ar)
+ Here is the call graph for this function:

◆ updateIndices()

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

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

References arConnectorDB\updateIndices().

267  {
268  $this->arConnectorDB->updateIndices($ar);
269  }
Class arConnectorDB.
updateIndices(ActiveRecord $ar)
+ 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: