aboutsummaryrefslogtreecommitdiff
path: root/lib/classes
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2023-10-02 09:19:55 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2023-10-02 09:19:55 +0000
commitfe64b827e2e503085c6f596eeed08d6ece36624b (patch)
tree4404ebfc07eec72f1bb46bd19f8244ecc0b7b48a /lib/classes
parent8554b74bb2cc62bda4bdeb8ba6b081fde5f619ce (diff)
fixes #3029
Closes #3029 Merge request studip/studip!2036
Diffstat (limited to 'lib/classes')
-rw-r--r--lib/classes/StudipCache.class.php32
-rw-r--r--lib/classes/StudipCacheProxy.php15
-rw-r--r--lib/classes/StudipCacheWrapper.php15
-rw-r--r--lib/classes/StudipDbCache.class.php2
-rw-r--r--lib/classes/StudipFileCache.class.php6
-rw-r--r--lib/classes/StudipMemcachedCache.php2
-rw-r--r--lib/classes/StudipMemoryCache.class.php15
-rw-r--r--lib/classes/StudipRedisCache.class.php2
-rw-r--r--lib/classes/StudipSystemCache.class.php49
9 files changed, 81 insertions, 57 deletions
diff --git a/lib/classes/StudipCache.class.php b/lib/classes/StudipCache.class.php
index 79e80e3..ba929f9 100644
--- a/lib/classes/StudipCache.class.php
+++ b/lib/classes/StudipCache.class.php
@@ -59,4 +59,36 @@ interface StudipCache
* @return bool returns TRUE on success or FALSE on failure.
*/
public function write($name, $content, $expires = self::DEFAULT_EXPIRATION);
+
+ /**
+ * @return string A translateable display name for this cache class.
+ */
+ public static function getDisplayName(): string;
+
+ /**
+ * Get some statistics from cache, like number of entries, hit rate or
+ * whatever the underlying cache provides.
+ * Results are returned in form of an array like
+ * "[
+ * [
+ * 'name' => <displayable name>
+ * 'value' => <value of the current stat>
+ * ]
+ * ]"
+ *
+ * @return array
+ */
+ public function getStats(): array;
+
+ /**
+ * Return the Vue component name and props that handle configuration.
+ * The associative array is of the form
+ * [
+ * 'component' => <Vue component name>,
+ * 'props' => <Properties for component>
+ * ]
+ *
+ * @return array
+ */
+ public static function getConfig(): array;
}
diff --git a/lib/classes/StudipCacheProxy.php b/lib/classes/StudipCacheProxy.php
index 74df560..686f812 100644
--- a/lib/classes/StudipCacheProxy.php
+++ b/lib/classes/StudipCacheProxy.php
@@ -99,4 +99,19 @@ class StudipCacheProxy implements StudipCache
return $this->actual_cache->write($key, $content, $expires);
}
+
+ public static function getDisplayName(): string
+ {
+ return static::class;
+ }
+
+ public function getStats(): array
+ {
+ return $this->actual_cache->getStats();
+ }
+
+ public static function getConfig(): array
+ {
+ return [];
+ }
}
diff --git a/lib/classes/StudipCacheWrapper.php b/lib/classes/StudipCacheWrapper.php
index 950e9a6..6c75c01 100644
--- a/lib/classes/StudipCacheWrapper.php
+++ b/lib/classes/StudipCacheWrapper.php
@@ -67,4 +67,19 @@ class StudipCacheWrapper implements StudipCache
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 [];
+ }
}
diff --git a/lib/classes/StudipDbCache.class.php b/lib/classes/StudipDbCache.class.php
index 38fdee8..865825e 100644
--- a/lib/classes/StudipDbCache.class.php
+++ b/lib/classes/StudipDbCache.class.php
@@ -7,7 +7,7 @@
*
* @author Elmar Ludwig <elmar.ludwig@uos.de>
*/
-class StudipDbCache implements StudipSystemCache
+class StudipDbCache implements StudipCache
{
/**
diff --git a/lib/classes/StudipFileCache.class.php b/lib/classes/StudipFileCache.class.php
index 8e46d25..9eae66c 100644
--- a/lib/classes/StudipFileCache.class.php
+++ b/lib/classes/StudipFileCache.class.php
@@ -31,7 +31,7 @@
* @author André Noack <noack@data-quest.de>
* @version 2
*/
-class StudipFileCache implements StudipSystemCache
+class StudipFileCache implements StudipCache
{
use StudipCacheKeyTrait;
@@ -236,8 +236,6 @@ class StudipFileCache implements StudipSystemCache
/**
* Return statistics.
*
- * @StudipSystemCache::getStats()
- *
* @return array|array[]
*/
public function getStats(): array
@@ -253,8 +251,6 @@ class StudipFileCache implements StudipSystemCache
/**
* Return the Vue component name and props that handle configuration.
*
- * @see StudipSystemCache::getConfig()
- *
* @return array
*/
public static function getConfig(): array
diff --git a/lib/classes/StudipMemcachedCache.php b/lib/classes/StudipMemcachedCache.php
index 619a61e..0e44dd5 100644
--- a/lib/classes/StudipMemcachedCache.php
+++ b/lib/classes/StudipMemcachedCache.php
@@ -21,7 +21,7 @@
* @since 5.0
*/
-class StudipMemcachedCache implements StudipSystemCache
+class StudipMemcachedCache implements StudipCache
{
use StudipCacheKeyTrait;
diff --git a/lib/classes/StudipMemoryCache.class.php b/lib/classes/StudipMemoryCache.class.php
index 57b35f9..d38385a 100644
--- a/lib/classes/StudipMemoryCache.class.php
+++ b/lib/classes/StudipMemoryCache.class.php
@@ -66,4 +66,19 @@ class StudipMemoryCache implements StudipCache
return true;
}
+
+ public static function getDisplayName(): string
+ {
+ return 'Memory cache';
+ }
+
+ public function getStats(): array
+ {
+ return [];
+ }
+
+ public static function getConfig(): array
+ {
+ return [];
+ }
}
diff --git a/lib/classes/StudipRedisCache.class.php b/lib/classes/StudipRedisCache.class.php
index 43a585f..c485b78 100644
--- a/lib/classes/StudipRedisCache.class.php
+++ b/lib/classes/StudipRedisCache.class.php
@@ -8,7 +8,7 @@
* @subpackage cache
* @since Stud.IP 5.0
*/
-class StudipRedisCache implements StudipSystemCache
+class StudipRedisCache implements StudipCache
{
use StudipCacheKeyTrait;
diff --git a/lib/classes/StudipSystemCache.class.php b/lib/classes/StudipSystemCache.class.php
deleted file mode 100644
index 895d121..0000000
--- a/lib/classes/StudipSystemCache.class.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-/**
- * An interface which has to be implemented by caches available for administration
- * via Stud.IP GUI
- *
- * @package studip
- * @subpackage lib
- *
- * @author Thomas Hackl <studip@thomas-hackl.name>
- * @copyright 2021 Stud.IP Core-Group
- * @since Stud.IP 5.0
- * @license GPL2 or any later version
- */
-
-interface StudipSystemCache extends StudipCache
-{
-
- /**
- * @return string A translateable display name for this cache class.
- */
- public static function getDisplayName(): string;
-
- /**
- * Get some statistics from cache, like number of entries, hit rate or
- * whatever the underlying cache provides.
- * Results are returned in form of an array like
- * "[
- * [
- * 'name' => <displayable name>
- * 'value' => <value of the current stat>
- * ]
- * ]"
- *
- * @return array
- */
- public function getStats(): array;
-
- /**
- * Return the Vue component name and props that handle configuration.
- * The associative array is of the form
- * [
- * 'component' => <Vue component name>,
- * 'props' => <Properties for component>
- * ]
- *
- * @return array
- */
- public static function getConfig(): array;
-}