mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-15 09:19: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);
|
||||
}
|
||||
|
||||
function isValid($key, $modified_time = 0)
|
||||
{
|
||||
$key = md5(_XE_PATH_.$key);
|
||||
$obj = apc_fetch($key, $success);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
if($modified_time > 0 && $modified_time > $obj[0]) {
|
||||
$this->_delete($_key);
|
||||
return false;
|
||||
}
|
||||
|
||||
return $obj[1];
|
||||
}
|
||||
|
||||
function _delete($_key)
|
||||
{
|
||||
function _delete($_key) {
|
||||
$this->put($_key,null,1);
|
||||
}
|
||||
|
||||
function delete($key)
|
||||
{
|
||||
function delete($key) {
|
||||
$this->_delete(md5(_XE_PATH_.$key));
|
||||
}
|
||||
|
||||
function truncate()
|
||||
{
|
||||
function truncate() {
|
||||
apc_clear_cache('user');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue