mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-26 22:59:57 +09:00
fixed APC Delete Cache Object
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7460 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
6a9267f8bf
commit
d2eecc54ec
1 changed files with 13 additions and 20 deletions
33
classes/cache/CacheApc.class.php
vendored
33
classes/cache/CacheApc.class.php
vendored
|
|
@ -30,49 +30,42 @@
|
||||||
return apc_store(md5(_XE_PATH_.$key), array(time(), $buff), $valid_time);
|
return apc_store(md5(_XE_PATH_.$key), array(time(), $buff), $valid_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isValid($key, $modified_time = 0)
|
function isValid($key, $modified_time = 0) {
|
||||||
{
|
$_key = md5(_XE_PATH_.$key);
|
||||||
$key = md5(_XE_PATH_.$key);
|
$obj = apc_fetch($_key, $success);
|
||||||
$obj = apc_fetch($key, $success);
|
|
||||||
if(!$success || !is_array($obj)) return false;
|
if(!$success || !is_array($obj)) return false;
|
||||||
unset($obj[1]);
|
unset($obj[1]);
|
||||||
|
|
||||||
if($modified_time > 0 && $modified_time > $obj[0])
|
if($modified_time > 0 && $modified_time > $obj[0]) {
|
||||||
{
|
$this->_delete($_key);
|
||||||
$this->delete($_key);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get($key, $modified_time = 0)
|
function get($key, $modified_time = 0) {
|
||||||
{
|
$_key = md5(_XE_PATH_.$key);
|
||||||
$key = md5(_XE_PATH_.$key);
|
$obj = apc_fetch($_key, $success);
|
||||||
$obj = apc_fetch($key, $success);
|
|
||||||
if(!$success || !is_array($obj)) return false;
|
if(!$success || !is_array($obj)) return false;
|
||||||
|
|
||||||
if($modified_time > 0 && $modified_time > $obj[0])
|
if($modified_time > 0 && $modified_time > $obj[0]) {
|
||||||
{
|
$this->_delete($_key);
|
||||||
$this->_delete($key);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $obj[1];
|
return $obj[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
function _delete($_key)
|
function _delete($_key) {
|
||||||
{
|
|
||||||
$this->put($_key,null,1);
|
$this->put($_key,null,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete($key)
|
function delete($key) {
|
||||||
{
|
|
||||||
$this->_delete(md5(_XE_PATH_.$key));
|
$this->_delete(md5(_XE_PATH_.$key));
|
||||||
}
|
}
|
||||||
|
|
||||||
function truncate()
|
function truncate() {
|
||||||
{
|
|
||||||
apc_clear_cache('user');
|
apc_clear_cache('user');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue