diff options
| author | Philipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de> | 2024-09-24 10:53:31 +0200 |
|---|---|---|
| committer | Philipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de> | 2024-09-24 10:53:31 +0200 |
| commit | 4459dd7917f4d1c34f40bb68f0e991e9c3d53e4c (patch) | |
| tree | 5c07151ae61276d334e88f6309c30d439a85c12e /lib/classes/StudipCacheWrapper.php | |
| parent | da0022e5c1abbf9825ae76debaabdff7e8623bb4 (diff) | |
| parent | 97a188592c679890a25c37ab78463add76a52ff7 (diff) | |
Merge branch 'main' into issue-3911issue-3911
Diffstat (limited to 'lib/classes/StudipCacheWrapper.php')
| -rw-r--r-- | lib/classes/StudipCacheWrapper.php | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/lib/classes/StudipCacheWrapper.php b/lib/classes/StudipCacheWrapper.php deleted file mode 100644 index 6c75c01..0000000 --- a/lib/classes/StudipCacheWrapper.php +++ /dev/null @@ -1,85 +0,0 @@ -<?php - -/** - * The cache wrapper wraps a memory cache around another cache. This should - * reduce the accesses to the actual cache. - * - * @author Jan-Hendrik Willms <tleilax+studip@gmail.com> - * @license GPL2 or any later version - * @since Stud.IP 5.4 - */ -class StudipCacheWrapper implements StudipCache -{ - const DEFAULT_MEMORY_EXPIRATION = 60; - - protected $actual_cache; - protected $memory_cache; - - public function __construct(StudipCache $actual_cache) - { - $this->actual_cache = $actual_cache; - $this->memory_cache = new StudipMemoryCache(); - } - - /** - * @inheritdoc - */ - public function expire($arg) - { - $this->memory_cache->expire($arg); - $this->actual_cache->expire($arg); - } - - /** - * @inheritdoc - */ - public function flush() - { - $this->memory_cache->flush(); - $this->actual_cache->flush(); - } - - /** - * @inheritdoc - */ - public function read($arg) - { - $cached = $this->memory_cache->read($arg); - if ($cached !== false) { - return $cached; - } - - $cached = $this->actual_cache->read($arg); - if ($cached !== false) { - $this->memory_cache->write($arg, $cached, self::DEFAULT_MEMORY_EXPIRATION); - } - return $cached; - } - - /** - * @inheritdoc - */ - public function write($name, $content, $expires = self::DEFAULT_EXPIRATION) - { - if ($this->actual_cache->write($name, $content, $expires)) { - return $this->memory_cache->write($name, $content, $expires); - } else { - return false; - } - } - - public static function getDisplayName(): string - { - return static::class; - } - - public function getStats(): array - { - return $this->actual_cache->getStats(); - } - - public static function getConfig(): array - { - return []; - } -} |
