mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 18:51:41 +09:00
Changed the way document search results are removed from cache - instead of delete, key incrementing is now used.
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9500 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
484a2e8791
commit
a69023da83
4 changed files with 62 additions and 92 deletions
32
classes/cache/CacheHandler.class.php
vendored
32
classes/cache/CacheHandler.class.php
vendored
|
|
@ -8,7 +8,7 @@
|
|||
**/
|
||||
|
||||
class CacheHandler extends Handler {
|
||||
|
||||
|
||||
var $handler = null;
|
||||
|
||||
function &getInstance($target='object') {
|
||||
|
|
@ -21,13 +21,13 @@
|
|||
if($target == 'object'){
|
||||
if($info->use_object_cache =='apc') $type = 'apc';
|
||||
else if(substr($info->use_object_cache,0,8)=='memcache'){
|
||||
$type = 'memcache';
|
||||
$type = 'memcache';
|
||||
$url = $info->use_object_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';
|
||||
$type = 'memcache';
|
||||
$url = $info->use_template_cache;
|
||||
}
|
||||
}
|
||||
|
|
@ -69,9 +69,35 @@
|
|||
if(!$this->handler) return false;
|
||||
return $this->handler->truncate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used for generating keys for similar objects.
|
||||
*
|
||||
* Ex: 1:document:123
|
||||
* 1:document:777
|
||||
*
|
||||
* This allows easily removing all object of type "document"
|
||||
* from cache by simply invalidating the group key.
|
||||
*
|
||||
* The new key will be 2:document:123, thus forcing the document
|
||||
* to be reloaded from the database.
|
||||
*/
|
||||
function getGroupKey($keyGroupName, $key){
|
||||
if(!$this->keyGroupVersions[$keyGroupName]){
|
||||
$this->keyGroupVersions[$keyGroupName] = 1;
|
||||
}
|
||||
|
||||
return $this->keyGroupVersions[$keyGroupName] . ':' . $keyGroupName . ':' . $key;
|
||||
}
|
||||
|
||||
function invalidateGroupKey($keyGroupName){
|
||||
$this->keyGroupVersions[$keyGroupName]++;
|
||||
}
|
||||
}
|
||||
|
||||
class CacheBase{
|
||||
var $keyGroupVersions = array();
|
||||
|
||||
function get($key, $modified_time = 0){
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue