From bc286c8aad1325bff6f28b21a886dc5f162ca374 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Tue, 10 May 2016 13:49:27 +0100 Subject: [PATCH] Added support for XCache. --- AcceleratorCacheClearer.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/AcceleratorCacheClearer.php b/AcceleratorCacheClearer.php index 9063c9d..3f537f6 100644 --- a/AcceleratorCacheClearer.php +++ b/AcceleratorCacheClearer.php @@ -60,6 +60,15 @@ private static function clearUserCache() return 'APC User Cache: success.'; } + if (function_exists('xcache_clear_cache')) { + $cnt = xcache_count(XC_TYPE_VAR); + for ($i=0; $i < $cnt; $i++) { + xcache_clear_cache(XC_TYPE_VAR, $i); + } + + return 'XCache User Cache: success.'; + } + if (function_exists('wincache_ucache_clear') && wincache_ucache_clear()) { return 'Wincache User Cache: success.'; } @@ -80,6 +89,15 @@ private static function clearOpcodeCache() return 'APC Opcode Cache: success.'; } + if (function_exists('xcache_clear_cache')) { + $cnt = xcache_count(XC_TYPE_PHP); + for ($i=0; $i < $cnt; $i++) { + xcache_clear_cache(XC_TYPE_PHP, $i); + } + + return 'XCache Opcode Cache: success.'; + } + throw new \RuntimeException('Opcode Cache: failure.'); } }