MDL-36120 cache: now uses sha1 and has an option for simple keys

This commit is contained in:
Sam Hemelryk
2012-11-07 10:03:32 +13:00
parent 08aaa637fb
commit 47834bcd41
8 changed files with 97 additions and 10 deletions
+3 -1
View File
@@ -794,12 +794,14 @@ class cache implements cache_loader {
* @return string|array String unless the store supports multi-identifiers in which case an array if returned.
*/
protected function parse_key($key) {
// First up if the store supports multiple keys we'll go with that.
if ($this->store->supports_multiple_indentifiers()) {
$result = $this->definition->generate_multi_key_parts();
$result['key'] = $key;
return $result;
}
return cache_helper::hash_key($this->definition->generate_single_key_prefix().'-'.$key);
// If not we need to generate a hash and to for that we use the cache_helper.
return cache_helper::hash_key($key, $this->definition);
}
/**