diff options
| author | Moritz Strohm <strohm@data-quest.de> | 2024-05-14 07:22:47 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2024-05-14 07:22:47 +0000 |
| commit | 40bdfaf4415ff9f46e63435fc5e61049649802f2 (patch) | |
| tree | f3ae85d9edaef23db555a829571ff968c21f9af5 /lib/classes/StudipMemoryCache.class.php | |
| parent | 636039e25ccc6c33ae758bdb3ddfca4f68327948 (diff) | |
made Stud.IP cache compatible with PSR-6, re #3701
Merge request studip/studip!2570
Diffstat (limited to 'lib/classes/StudipMemoryCache.class.php')
| -rw-r--r-- | lib/classes/StudipMemoryCache.class.php | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/lib/classes/StudipMemoryCache.class.php b/lib/classes/StudipMemoryCache.class.php deleted file mode 100644 index d38385a..0000000 --- a/lib/classes/StudipMemoryCache.class.php +++ /dev/null @@ -1,84 +0,0 @@ -<?php -/** - * The php memory implementation of the StudipCache interface. - * - * @author Jan-Hendrik Willms <tleilax+studip@gmail.com> - * @license GPL2 or any later version - * @since Stud.IP 5.0 - */ -class StudipMemoryCache implements StudipCache -{ - protected $memory_cache = []; - - /** - * Expires just a single key. - * - * @param string the key - */ - public function expire($key) - { - unset($this->memory_cache[$key]); - } - - /** - * Expire all items from the cache. - */ - public function flush() - { - $this->memory_cache = []; - } - - /** - * Reads just a single key from the cache. - * - * @param string the key - * - * @return mixed the corresponding value - */ - public function read($key) - { - if (!isset($this->memory_cache[$key])) { - return false; - } - if ($this->memory_cache[$key]['expires'] < time()) { - $this->expire($key); - return false; - } - return $this->memory_cache[$key]['data']; - } - - /** - * Store data at the server. - * - * @param string the item's key. - * @param mixed the item's content (will be serialized if necessary). - * @param int the item's expiry time in seconds. Defaults to 12h. - * - * @returns mixed returns TRUE on success or FALSE on failure. - * - */ - public function write($name, $content, $expires = self::DEFAULT_EXPIRATION) - { - $this->memory_cache[$name] = [ - 'expires' => time() + $expires, - 'data' => $content, - ]; - - return true; - } - - public static function getDisplayName(): string - { - return 'Memory cache'; - } - - public function getStats(): array - { - return []; - } - - public static function getConfig(): array - { - return []; - } -} |
