aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/memcache/xcache.php14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/memcache/xcache.php b/lib/memcache/xcache.php
index 7880518fd9f..e0acb11b054 100644
--- a/lib/memcache/xcache.php
+++ b/lib/memcache/xcache.php
@@ -37,7 +37,12 @@ class XCache extends Cache {
}
public function clear($prefix='') {
- xcache_unset_by_prefix($this->getNamespace().$prefix);
+ if (function_exists('xcache_unset_by_prefix')) {
+ xcache_unset_by_prefix($this->getNamespace().$prefix);
+ } else {
+ // Since we can not clear by prefix, we just clear the whole cache.
+ xcache_clear_cache(\XC_TYPE_VAR, 0);
+ }
return true;
}
@@ -56,10 +61,3 @@ class XCache extends Cache {
return true;
}
}
-
-if(!function_exists('xcache_unset_by_prefix')) {
- function xcache_unset_by_prefix($prefix) {
- // Since we can't clear targetted cache, we'll clear all. :(
- xcache_clear_cache(\XC_TYPE_VAR, 0);
- }
-}