Merge branch 'MDL-40555-master' of git://github.com/FMCorz/moodle

Conflicts:
	cache/stores/static/lib.php
This commit is contained in:
Eloy Lafuente (stronk7) 2013-07-16 09:57:34 +02:00
commit 3f0a8871d3
3 changed files with 100 additions and 2 deletions

View file

@ -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;
}
/**
@ -418,4 +419,28 @@ class cachestore_static extends static_data_store implements cache_is_key_aware
public function my_name() {
return $this->name;
}
/**
* 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;
}
}