Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/cache
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-07-22 04:31:43 +0400
committerRobin Appelman <icewind@owncloud.com>2012-07-22 04:31:48 +0400
commit51566e87c7343385ae3b6854386c20974c94a53d (patch)
tree35b50a0cf64ed280f037902a87504d2af3a92428 /lib/cache
parent2b747789588e34bce24bd558f7e979a6e0ea8047 (diff)
add prefix option to OC_Cache::clear
Diffstat (limited to 'lib/cache')
-rw-r--r--lib/cache/apc.php5
-rw-r--r--lib/cache/broker.php6
-rw-r--r--lib/cache/file.php5
-rw-r--r--lib/cache/xcache.php5
4 files changed, 12 insertions, 9 deletions
diff --git a/lib/cache/apc.php b/lib/cache/apc.php
index 6cf47d0c158..c192fe2f196 100644
--- a/lib/cache/apc.php
+++ b/lib/cache/apc.php
@@ -43,14 +43,15 @@ class OC_Cache_APC {
return apc_delete($this->getNamespace().$key);
}
- public function clear(){
- $ns = $this->getNamespace();
+ public function clear($prefix=''){
+ $ns = $this->getNamespace().$prefix;
$cache = apc_cache_info('user');
foreach($cache['cache_list'] as $entry) {
if (strpos($entry['info'], $ns) === 0) {
apc_delete($entry['info']);
}
}
+ return true;
}
}
if(!function_exists('apc_exists')) {
diff --git a/lib/cache/broker.php b/lib/cache/broker.php
index 931d0dd407e..c2aceabaf53 100644
--- a/lib/cache/broker.php
+++ b/lib/cache/broker.php
@@ -46,8 +46,8 @@ class OC_Cache_Broker {
return $this->slow_cache->remove($key);
}
- public function clear(){
- $this->fast_cache->clear();
- $this->slow_cache->clear();
+ public function clear($prefix=''){
+ $this->fast_cache->clear($prefix);
+ $this->slow_cache->clear($prefix);
}
}
diff --git a/lib/cache/file.php b/lib/cache/file.php
index 0b7d3e30508..562c3d17167 100644
--- a/lib/cache/file.php
+++ b/lib/cache/file.php
@@ -62,15 +62,16 @@ class OC_Cache_File{
return $storage->unlink($key);
}
- public function clear(){
+ public function clear($prefix=''){
$storage = $this->getStorage();
if($storage and $storage->is_dir('/')){
$dh=$storage->opendir('/');
while($file=readdir($dh)){
- if($file!='.' and $file!='..'){
+ if($file!='.' and $file!='..' and ($prefix==='' || strpos($file, $prefix) === 0)){
$storage->unlink('/'.$file);
}
}
}
+ return true;
}
}
diff --git a/lib/cache/xcache.php b/lib/cache/xcache.php
index bd55cee8f6b..951f9b47545 100644
--- a/lib/cache/xcache.php
+++ b/lib/cache/xcache.php
@@ -43,7 +43,8 @@ class OC_Cache_XCache {
return xcache_unset($this->getNamespace().$key);
}
- public function clear(){
- return xcache_unset_by_prefix($this->getNamespace());
+ public function clear($prefix=''){
+ xcache_unset_by_prefix($this->getNamespace().$prefix);
+ return true;
}
}