ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
arConnectorCache Class Reference

Class ilGSStorageCache. More...

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

Public Member Functions

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

Protected Member Functions

 buildCacheKey (ActiveRecord $activeRecord)
 

Private Member Functions

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

Private Attributes

Container $cache_container
 

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 27 of file class.arConnectorCache.php.

Constructor & Destructor Documentation

◆ __construct()

arConnectorCache::__construct ( private arConnector  $arConnector)

ilGSStorageCache constructor.

Parameters
int$ttl

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

36 {
37 global $DIC;
38 $this->cache_container = $DIC->globalCache()->get($this);
39 }
global $DIC
Definition: shib_login.php:26

References $DIC.

Member Function Documentation

◆ affectedRows()

arConnectorCache::affectedRows ( ActiveRecordList  $activeRecordList)

Reimplemented from arConnector.

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

162 : int
163 {
164 return $this->arConnector->affectedRows($activeRecordList);
165 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
affectedRows(ActiveRecordList $activeRecordList)

References arConnector\affectedRows().

+ Here is the call graph for this function:

◆ buildCacheKey()

arConnectorCache::buildCacheKey ( ActiveRecord  $activeRecord)
protected

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

41 : string
42 {
43 return $activeRecord->getConnectorContainerName() . "_" . $activeRecord->getPrimaryFieldValue();
44 }
getConnectorContainerName()
@description Return the Name of your Connector Table

References ActiveRecord\getConnectorContainerName(), and ActiveRecord\getPrimaryFieldValue().

Referenced by delete(), read(), and storeActiveRecordInCache().

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

◆ checkConnection()

arConnectorCache::checkConnection ( ActiveRecord  $activeRecord)

Reimplemented from arConnector.

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

64 : bool
65 {
66 return $this->arConnector->checkConnection($activeRecord);
67 }
checkConnection(ActiveRecord $activeRecord)

References arConnector\checkConnection().

+ Here is the call graph for this function:

◆ checkFieldExists()

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

Reimplemented from arConnector.

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

94 : bool
95 {
96 return $this->arConnector->checkFieldExists($activeRecord, $field_name);
97 }
checkFieldExists(ActiveRecord $activeRecord, string $field_name)

References arConnector\checkFieldExists().

+ Here is the call graph for this function:

◆ checkTableExists()

arConnectorCache::checkTableExists ( ActiveRecord  $activeRecord)

Reimplemented from arConnector.

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

89 : bool
90 {
91 return $this->arConnector->checkTableExists($activeRecord);
92 }
checkTableExists(ActiveRecord $activeRecord)

References arConnector\checkTableExists().

+ Here is the call graph for this function:

◆ create()

arConnectorCache::create ( ActiveRecord  $activeRecord)

Reimplemented from arConnector.

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

109 : void
110 {
111 $this->arConnector->create($activeRecord);
112 $this->storeActiveRecordInCache($activeRecord);
113 }
storeActiveRecordInCache(ActiveRecord $activeRecord)
Stores an active record into the Cache.
create(ActiveRecord $activeRecord)

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

+ Here is the call graph for this function:

◆ delete()

arConnectorCache::delete ( ActiveRecord  $activeRecord)

Reimplemented from arConnector.

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

147 : void
148 {
149 $this->arConnector->delete($activeRecord);
150 $key = $this->buildCacheKey($activeRecord);
151 $this->cache_container->delete($key);
152 }
buildCacheKey(ActiveRecord $activeRecord)
delete(ActiveRecord $activeRecord)

References buildCacheKey(), and arConnector\delete().

+ Here is the call graph for this function:

◆ getContainerKey()

arConnectorCache::getContainerKey ( )

Implements ILIAS\Cache\Container\Request.

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

46 : string
47 {
48 return 'ar_cache';
49 }

◆ installDatabase()

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

Reimplemented from arConnector.

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

69 : bool
70 {
71 return $this->arConnector->installDatabase($activeRecord, $fields);
72 }
installDatabase(ActiveRecord $activeRecord, array $fields)

References arConnector\installDatabase().

+ Here is the call graph for this function:

◆ isForced()

arConnectorCache::isForced ( )

Implements ILIAS\Cache\Container\Request.

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

51 : bool
52 {
53 return false;
54 }

◆ nextID()

arConnectorCache::nextID ( ActiveRecord  $activeRecord)
Returns
mixed

Reimplemented from arConnector.

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

60 {
61 return $this->arConnector->nextID($activeRecord);
62 }
nextID(ActiveRecord $activeRecord)

References arConnector\nextID().

+ Here is the call graph for this function:

◆ quote()

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

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

170 : string
171 {
172 return $this->arConnector->quote($value, $type);
173 }
quote(mixed $value, string $type)

References arConnector\quote().

+ Here is the call graph for this function:

◆ read()

arConnectorCache::read ( ActiveRecord  $activeRecord)
Returns
\stdClass[]|mixed[]

Reimplemented from arConnector.

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

118 : array
119 {
120 $key = $this->buildCacheKey($activeRecord);
121 if ($this->cache_container->has($key)) {
122 $cached_value = $this->cache_container->get(
123 $key,
124 new Transformation(fn($value): ?array => is_array($value) ? $value : null)
125 );
126 if (is_array($cached_value)) {
127 return array_map(fn($result): \stdClass => (object) $result, $cached_value);
128 }
129 }
130
131 $results = $this->arConnector->read($activeRecord);
132
133 $this->cache_container->set(
134 $key,
135 array_map(fn($result): array => (array) $result, $results)
136 );
137
138 return $results;
139 }
Transform values according to custom configuration.
read(ActiveRecord $activeRecord)
$results

References $results, buildCacheKey(), and arConnector\read().

+ Here is the call graph for this function:

◆ readSet()

arConnectorCache::readSet ( ActiveRecordList  $activeRecordList)
Returns
mixed[]

Reimplemented from arConnector.

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

157 : array
158 {
159 return $this->arConnector->readSet($activeRecordList);
160 }
readSet(ActiveRecordList $activeRecordList)

References arConnector\readSet().

+ Here is the call graph for this function:

◆ removeField()

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

Reimplemented from arConnector.

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

99 : bool
100 {
101 return $this->arConnector->removeField($activeRecord, $field_name);
102 }
removeField(ActiveRecord $activeRecord, string $field_name)

References arConnector\removeField().

+ Here is the call graph for this function:

◆ renameField()

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

Reimplemented from arConnector.

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

104 : bool
105 {
106 return $this->arConnector->renameField($activeRecord, $old_name, $new_name);
107 }
renameField(ActiveRecord $activeRecord, string $old_name, string $new_name)

References arConnector\renameField().

+ Here is the call graph for this function:

◆ resetDatabase()

arConnectorCache::resetDatabase ( ActiveRecord  $activeRecord)

Reimplemented from arConnector.

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

79 : bool
80 {
81 return $this->arConnector->resetDatabase($activeRecord);
82 }
resetDatabase(ActiveRecord $activeRecord)

References arConnector\resetDatabase().

+ Here is the call graph for this function:

◆ storeActiveRecordInCache()

arConnectorCache::storeActiveRecordInCache ( ActiveRecord  $activeRecord)
private

Stores an active record into the Cache.

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

183 : void
184 {
185 $key = $this->buildCacheKey($activeRecord);
186 $value = $activeRecord->asArray();
187
188 $this->cache_container->set($key, $value);
189 }

References ActiveRecord\asArray(), and buildCacheKey().

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  $activeRecord)

Reimplemented from arConnector.

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

84 : bool
85 {
86 return $this->arConnector->truncateDatabase($activeRecord);
87 }
truncateDatabase(ActiveRecord $activeRecord)

References arConnector\truncateDatabase().

+ Here is the call graph for this function:

◆ update()

arConnectorCache::update ( ActiveRecord  $activeRecord)

Reimplemented from arConnector.

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

141 : void
142 {
143 $this->arConnector->update($activeRecord);
144 $this->storeActiveRecordInCache($activeRecord);
145 }
update(ActiveRecord $activeRecord)

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

+ Here is the call graph for this function:

◆ updateDatabase()

arConnectorCache::updateDatabase ( ActiveRecord  $activeRecord)

Reimplemented from arConnector.

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

74 : bool
75 {
76 return $this->arConnector->updateDatabase($activeRecord);
77 }
updateDatabase(ActiveRecord $activeRecord)

References arConnector\updateDatabase().

+ Here is the call graph for this function:

◆ updateIndices()

arConnectorCache::updateIndices ( ActiveRecord  $activeRecord)

Reimplemented from arConnector.

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

175 : void
176 {
177 $this->arConnector->updateIndices($activeRecord);
178 }
updateIndices(ActiveRecord $activeRecord)

References arConnector\updateIndices().

+ Here is the call graph for this function:

Field Documentation

◆ $cache_container

Container arConnectorCache::$cache_container
private

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


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