From c9bc66ce7e35c40b7c84c5bad563a37f9f9b1afa Mon Sep 17 00:00:00 2001
From: gloas <gloas@afi-sa.fr>
Date: Thu, 21 Oct 2021 11:23:28 +0200
Subject: [PATCH] hotline #142649 upgrade cache key

---
 src/Storm/Cache.php | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/Storm/Cache.php b/src/Storm/Cache.php
index 2b3513f3..ada41ee5 100644
--- a/src/Storm/Cache.php
+++ b/src/Storm/Cache.php
@@ -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;
-- 
GitLab