mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-24 04:42:14 +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
72
classes/cache/CacheApc.class.php
vendored
Normal file
72
classes/cache/CacheApc.class.php
vendored
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
/**
|
||||
* @class CacheApc
|
||||
* @author sol (sol@nhn.com)
|
||||
* @brief APC Handler
|
||||
* @version 0.1
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
class CacheApc extends CacheBase {
|
||||
var $valid_time = 36000;
|
||||
|
||||
function getInstance($opt=null){
|
||||
if(!$GLOBALS['__CacheApc__']) {
|
||||
$GLOBALS['__CacheApc__'] = new CacheApc();
|
||||
}
|
||||
return $GLOBALS['__CacheApc__'];
|
||||
}
|
||||
|
||||
function CacheApc(){
|
||||
}
|
||||
|
||||
function isSupport(){
|
||||
return function_exists('apc_add');
|
||||
}
|
||||
|
||||
function put($key, $buff, $valid_time = 0){
|
||||
if($valid_time == 0) $valid_time = $this->valid_time;
|
||||
return apc_store(md5(_XE_PATH_.$key), array(time(), $buff), $valid_time);
|
||||
}
|
||||
|
||||
function isValid($key, $modified_time = 0) {
|
||||
$_key = md5(_XE_PATH_.$key);
|
||||
$obj = apc_fetch($_key, $success);
|
||||
if(!$success || !is_array($obj)) return false;
|
||||
unset($obj[1]);
|
||||
|
||||
if($modified_time > 0 && $modified_time > $obj[0]) {
|
||||
$this->_delete($_key);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function get($key, $modified_time = 0) {
|
||||
$_key = md5(_XE_PATH_.$key);
|
||||
$obj = apc_fetch($_key, $success);
|
||||
if(!$success || !is_array($obj)) return false;
|
||||
|
||||
if($modified_time > 0 && $modified_time > $obj[0]) {
|
||||
$this->_delete($_key);
|
||||
return false;
|
||||
}
|
||||
|
||||
return $obj[1];
|
||||
}
|
||||
|
||||
function _delete($_key) {
|
||||
$this->put($_key,null,1);
|
||||
}
|
||||
|
||||
function delete($key) {
|
||||
$this->_delete(md5(_XE_PATH_.$key));
|
||||
}
|
||||
|
||||
function truncate() {
|
||||
apc_clear_cache('user');
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue