#242 cache key에 xe core 버전명을 prefix로 사용.

This commit is contained in:
bnu 2014-01-01 00:22:36 +09:00
parent 2149ed7700
commit d2365bbd09
5 changed files with 21 additions and 30 deletions

View file

@ -8,13 +8,6 @@
* */ * */
class CacheApc extends CacheBase class CacheApc extends CacheBase
{ {
/**
* Default valid time
* @var int
*/
var $valid_time = 36000;
/** /**
* Get instance of CacheApc * Get instance of CacheApc
* *

View file

@ -10,13 +10,6 @@
*/ */
class CacheFile extends CacheBase class CacheFile extends CacheBase
{ {
/**
* Default valid time
* @var int
*/
var $valid_time = 36000;
/** /**
* Path that value to stored * Path that value to stored
* @var string * @var string
@ -56,7 +49,7 @@ class CacheFile extends CacheBase
*/ */
function getCacheFileName($key) function getCacheFileName($key)
{ {
return $this->cache_dir . str_replace(':', '_', $key); return $this->cache_dir . str_replace(':', '_', $key);
} }
/** /**

View file

@ -8,7 +8,6 @@
*/ */
class CacheHandler extends Handler class CacheHandler extends Handler
{ {
/** /**
* instance of cache handler * instance of cache handler
* @var CacheBase * @var CacheBase
@ -129,6 +128,17 @@ class CacheHandler extends Handler
return false; return false;
} }
/**
* Get cache name by key
*
* @param string $key The key that will be associated with the item.
* @return string Returns cache name
*/
function getCacheKey($key)
{
return __XE_VERSION__ . ':' . $key;
}
/** /**
* Get cached data * Get cached data
* *
@ -139,6 +149,7 @@ class CacheHandler extends Handler
*/ */
function get($key, $modified_time = 0) function get($key, $modified_time = 0)
{ {
$key = $this->getCacheKey($key);
if(!$this->handler) if(!$this->handler)
{ {
return false; return false;
@ -158,6 +169,7 @@ class CacheHandler extends Handler
*/ */
function put($key, $obj, $valid_time = 0) function put($key, $obj, $valid_time = 0)
{ {
$key = $this->getCacheKey($key);
if(!$this->handler) if(!$this->handler)
{ {
return false; return false;
@ -173,6 +185,7 @@ class CacheHandler extends Handler
*/ */
function delete($key) function delete($key)
{ {
$key = $this->getCacheKey($key);
if(!$this->handler) if(!$this->handler)
{ {
return false; return false;
@ -190,6 +203,7 @@ class CacheHandler extends Handler
*/ */
function isValid($key, $modified_time) function isValid($key, $modified_time)
{ {
$key = $this->getCacheKey($key);
if(!$this->handler) if(!$this->handler)
{ {
return false; return false;
@ -259,6 +273,11 @@ class CacheHandler extends Handler
*/ */
class CacheBase class CacheBase
{ {
/**
* Default valid time
* @var int
*/
var $valid_time = 36000;
/** /**
* Get cached data * Get cached data

View file

@ -8,13 +8,6 @@
*/ */
class CacheMemcache extends CacheBase class CacheMemcache extends CacheBase
{ {
/**
* Default valid time
* @var int
*/
var $valid_time = 36000;
/** /**
* instance of Memcahe * instance of Memcahe
* @var Memcahe * @var Memcahe

View file

@ -10,13 +10,6 @@
*/ */
class CacheWincache extends CacheBase class CacheWincache extends CacheBase
{ {
/**
* Default valid time
* @var int
*/
var $valid_time = 36000;
/** /**
* Get instance of CacheWincache * Get instance of CacheWincache
* *