You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.1 KiB
48 lines
1.1 KiB
<?php
|
|
/**
|
|
* @copyright NetMonsters <team@netmonsters.ru>
|
|
* @link http://netmonsters.ru
|
|
* @package Majestic
|
|
* @subpackage Cache
|
|
* @since 2010-03-10
|
|
* @version SVN: $Id$
|
|
* @filesource $URL$
|
|
*/
|
|
|
|
class CacheKeySet extends CacheKey
|
|
{
|
|
public function get()
|
|
{
|
|
$set = $this->cache->get($this->key);
|
|
$item_key = $this->getCacheKey();
|
|
|
|
if (!is_array($set) || !array_key_exists($item_key, $set)) {
|
|
return false;
|
|
}
|
|
return $this->cache->get($item_key);
|
|
}
|
|
|
|
/**
|
|
* @param mixed $value
|
|
*/
|
|
public function set($value)
|
|
{
|
|
$set = $this->cache->get($this->key);
|
|
if (!is_array($set)) {
|
|
$set = array();
|
|
}
|
|
|
|
$item_key = $this->getCacheKey();
|
|
if (!$this->cache->set($item_key, $value, $this->expire)) {
|
|
return false;
|
|
}
|
|
|
|
$set[$item_key] = $this->cache->getExpire($this->expire);
|
|
return $this->cache->set($this->key, $set, $this->expire);
|
|
}
|
|
|
|
public function del()
|
|
{
|
|
return $this->cache->del($this->key);
|
|
}
|
|
}
|