mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 18:51:41 +09:00
update trunk and tag 1.4.2.0
git-svn-id: http://xe-core.googlecode.com/svn/trunk@7470 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
55e72e3b47
commit
fae67f375d
70 changed files with 7400 additions and 507 deletions
95
classes/cache/CacheHandler.class.php
vendored
Normal file
95
classes/cache/CacheHandler.class.php
vendored
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
<?php
|
||||
/**
|
||||
* @class CacheHandler
|
||||
* @author sol (sol@nhn.com)
|
||||
* @brief Cache Handler
|
||||
* @version 0.1
|
||||
*
|
||||
**/
|
||||
|
||||
class CacheHandler extends Handler {
|
||||
|
||||
var $handler = null;
|
||||
|
||||
function &getInstance($target='object') {
|
||||
return new CacheHandler($target);
|
||||
}
|
||||
|
||||
function CacheHandler($target, $info=null) {
|
||||
if(!$info) $info = Context::getDBInfo();
|
||||
if($info){
|
||||
if($target == 'object'){
|
||||
if($info->use_template_cache =='apc') $type = 'apc';
|
||||
else if(substr($info->use_template_cache,0,8)=='memcache'){
|
||||
$type = 'memcache';
|
||||
$url = $info->use_template_cache;
|
||||
}
|
||||
}else if($target == 'template'){
|
||||
if($info->use_template_cache =='apc') $type = 'apc';
|
||||
else if(substr($info->use_template_cache,0,8)=='memcache'){
|
||||
$type = 'memcache';
|
||||
$url = $info->use_template_cache;
|
||||
}
|
||||
}
|
||||
|
||||
if($type){
|
||||
$class = 'Cache' . ucfirst($type);
|
||||
include_once sprintf('%sclasses/cache/%s.class.php', _XE_PATH_, $class);
|
||||
$this->handler = call_user_func(array($class,'getInstance'), $url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isSupport(){
|
||||
if($this->handler && $this->handler->isSupport()) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function get($key, $modified_time = 0){
|
||||
if(!$this->handler) return false;
|
||||
return $this->handler->get($key, $modified_time);
|
||||
}
|
||||
|
||||
function put($key, $obj, $valid_time = 0){
|
||||
if(!$this->handler) return false;
|
||||
return $this->handler->put($key, $obj, $valid_time);
|
||||
}
|
||||
|
||||
function delete($key){
|
||||
if(!$this->handler) return false;
|
||||
return $this->handler->delete($key);
|
||||
}
|
||||
|
||||
function isValid($key, $modified_time){
|
||||
if(!$this->handler) return false;
|
||||
return $this->handler->isValid($key, $modified_time);
|
||||
}
|
||||
|
||||
function truncate(){
|
||||
if(!$this->handler) return false;
|
||||
return $this->handler->truncate();
|
||||
}
|
||||
}
|
||||
|
||||
class CacheBase{
|
||||
function get($key, $modified_time = 0){
|
||||
return false;
|
||||
}
|
||||
|
||||
function put($key, $obj, $valid_time = 0){
|
||||
return false;
|
||||
}
|
||||
|
||||
function isValid($key, $modified_time = 0){
|
||||
return false;
|
||||
}
|
||||
|
||||
function isSupport(){
|
||||
return false;
|
||||
}
|
||||
|
||||
function truncate(){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue