Skip to content
Snippets Groups Projects

hotline #142649 upgrade cache key

Merged Ghislain Loas requested to merge hotline#142649 into master
Compare and
1 file
+ 10
3
Preferences
Compare changes
+ 10
3
@@ -82,17 +82,18 @@ class Storm_Cache {
}
public function setEnabled($enabled) {
$this->_enabled = $enabled;
return $this;
}
public function setCache($zend_cache) {
$this->_zend_cache = $zend_cache;
return $this;
}
public function memoize($key, $callback) {
if(!$this->_enabled)
return $callback();
@@ -105,6 +106,7 @@ class Storm_Cache {
return $data;
}
public function getCache() {
if(!isset($this->_zend_cache))
$this->_zend_cache = static::getDefaultZendCache();
@@ -143,7 +145,7 @@ class Storm_Cache {
public function addSeedToKey($key) {
return md5(json_encode([$this->_getRealSeed(), $key]));
return $this->_getRealSeed() . '_' . md5(json_encode([$key]));
}
@@ -159,13 +161,18 @@ class Storm_Cache {
protected function _generateRealSeed() {
$my_real_seed = uniqid(static::$_seed . '_');
$my_real_seed = uniqid(static::$_seed);
$this->getCache()->save($my_real_seed, static::$_seed);
return $my_real_seed;
}
public function getRealSeed() {
return $this->_getRealSeed();
}
public function clean(){
static::$_real_seed = $this->_generateRealSeed();
return $this;