From 62fc5a0a4994072ba7c61ffbe928a8e32b4b718f Mon Sep 17 00:00:00 2001 From: aterekhov Date: Tue, 27 Apr 2010 21:20:04 +0000 Subject: [PATCH] Removed possible collision in composite cache key #20 git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/branches/evo@144 4cb57b5f-5bbd-dd11-951b-001d605cbbc5 --- cache/CacheKey.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cache/CacheKey.php b/cache/CacheKey.php index 9271208..cd206e0 100644 --- a/cache/CacheKey.php +++ b/cache/CacheKey.php @@ -11,11 +11,11 @@ class CacheKey { - + protected $key; protected $params = ''; protected $expire = 0; - + /** * @param string $key * @param mixed $params @@ -30,20 +30,20 @@ class CacheKey } $this->cache = $cacheable->getCache(); $this->expire = $cacheable->getKeyExpire($this->key); - $this->params = (is_array($params)) ? implode('', $params) : $params; + $this->params = (is_array($params)) ? implode('|', $params) : $params; } - + protected function getCacheKey() { $params = ($this->params) ? ('_' . $this->params) : ''; return $this->key . $params; } - + protected function getExpire() { return $this->expire; } - + /** * @param int $expire */ @@ -51,12 +51,12 @@ class CacheKey { $this->expire = $expire; } - + public function get() { - return $this->cache->get($this->getCacheKey()); + return $this->cache->get($this->getCacheKey()); } - + /** * @param mixed $value */ @@ -64,7 +64,7 @@ class CacheKey { return $this->cache->set($this->getCacheKey(), $value, $this->expire); } - + public function del() { return $this->cache->del($this->getCacheKey());