diff --git a/cache/stores/static/lib.php b/cache/stores/static/lib.php index 405474abc4c..59b21f4b860 100644 --- a/cache/stores/static/lib.php +++ b/cache/stores/static/lib.php @@ -86,7 +86,7 @@ abstract class static_data_store extends cache_store { * @copyright 2012 Sam Hemelryk * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cachestore_static extends static_data_store implements cache_is_key_aware { +class cachestore_static extends static_data_store implements cache_is_key_aware, cache_is_searchable { /** * The name of the store @@ -133,7 +133,8 @@ class cachestore_static extends static_data_store implements cache_is_key_aware */ public static function get_supported_features(array $configuration = array()) { return self::SUPPORTS_DATA_GUARANTEE + - self::SUPPORTS_NATIVE_TTL; + self::SUPPORTS_NATIVE_TTL + + self::IS_SEARCHABLE; } /** @@ -411,4 +412,28 @@ class cachestore_static extends static_data_store implements cache_is_key_aware public function my_name() { return $this->name; } -} \ No newline at end of file + + /** + * Finds all of the keys being stored in the cache store instance. + * + * @return array + */ + public function find_all() { + return array_keys($this->store); + } + + /** + * Finds all of the keys whose keys start with the given prefix. + * + * @param string $prefix + */ + public function find_by_prefix($prefix) { + $return = array(); + foreach ($this->find_all() as $key) { + if (strpos($key, $prefix) === 0) { + $return[] = $key; + } + } + return $return; + } +}