Skip to content
Snippets Groups Projects
Commit fe64b827 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

fixes #3029

Closes #3029

Merge request !2036
parent 8554b74b
No related branches found
No related tags found
No related merge requests found
...@@ -59,4 +59,36 @@ interface StudipCache ...@@ -59,4 +59,36 @@ interface StudipCache
* @return bool returns TRUE on success or FALSE on failure. * @return bool returns TRUE on success or FALSE on failure.
*/ */
public function write($name, $content, $expires = self::DEFAULT_EXPIRATION); 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;
} }
...@@ -99,4 +99,19 @@ class StudipCacheProxy implements StudipCache ...@@ -99,4 +99,19 @@ class StudipCacheProxy implements StudipCache
return $this->actual_cache->write($key, $content, $expires); 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 [];
}
} }
...@@ -67,4 +67,19 @@ class StudipCacheWrapper implements StudipCache ...@@ -67,4 +67,19 @@ class StudipCacheWrapper implements StudipCache
return false; 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 [];
}
} }
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* @author Elmar Ludwig <elmar.ludwig@uos.de> * @author Elmar Ludwig <elmar.ludwig@uos.de>
*/ */
class StudipDbCache implements StudipSystemCache class StudipDbCache implements StudipCache
{ {
/** /**
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
* @author André Noack <noack@data-quest.de> * @author André Noack <noack@data-quest.de>
* @version 2 * @version 2
*/ */
class StudipFileCache implements StudipSystemCache class StudipFileCache implements StudipCache
{ {
use StudipCacheKeyTrait; use StudipCacheKeyTrait;
...@@ -236,8 +236,6 @@ class StudipFileCache implements StudipSystemCache ...@@ -236,8 +236,6 @@ class StudipFileCache implements StudipSystemCache
/** /**
* Return statistics. * Return statistics.
* *
* @StudipSystemCache::getStats()
*
* @return array|array[] * @return array|array[]
*/ */
public function getStats(): array public function getStats(): array
...@@ -253,8 +251,6 @@ class StudipFileCache implements StudipSystemCache ...@@ -253,8 +251,6 @@ class StudipFileCache implements StudipSystemCache
/** /**
* Return the Vue component name and props that handle configuration. * Return the Vue component name and props that handle configuration.
* *
* @see StudipSystemCache::getConfig()
*
* @return array * @return array
*/ */
public static function getConfig(): array public static function getConfig(): array
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
* @since 5.0 * @since 5.0
*/ */
class StudipMemcachedCache implements StudipSystemCache class StudipMemcachedCache implements StudipCache
{ {
use StudipCacheKeyTrait; use StudipCacheKeyTrait;
......
...@@ -66,4 +66,19 @@ class StudipMemoryCache implements StudipCache ...@@ -66,4 +66,19 @@ class StudipMemoryCache implements StudipCache
return true; return true;
} }
public static function getDisplayName(): string
{
return 'Memory cache';
}
public function getStats(): array
{
return [];
}
public static function getConfig(): array
{
return [];
}
} }
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* @subpackage cache * @subpackage cache
* @since Stud.IP 5.0 * @since Stud.IP 5.0
*/ */
class StudipRedisCache implements StudipSystemCache class StudipRedisCache implements StudipCache
{ {
use StudipCacheKeyTrait; use StudipCacheKeyTrait;
......
<?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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment