diff --git a/lib/cache/xcache.php b/lib/cache/xcache.php
index cecdf46351cb3c6c37cc4a069d345721ef26f185..9f380f870b98da0d83b72e77a90074abfdeddc8a 100644
--- a/lib/cache/xcache.php
+++ b/lib/cache/xcache.php
@@ -44,6 +44,12 @@ class OC_Cache_XCache {
 	}
 
 	public function clear($prefix='') {
+		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);
+			}
+		}
 		xcache_unset_by_prefix($this->getNamespace().$prefix);
 		return true;
 	}