|
|
@ -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()); |
|
|
|