From a26df886ab91af9772ee2449797b4900d0e44bec Mon Sep 17 00:00:00 2001 From: Awilum Date: Sat, 22 Jun 2019 20:06:42 +0300 Subject: [PATCH] Flextype Core: Cache - updates #165 - new method clearAll() added. - method clear() should have parameter $id --- flextype/core/Cache.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/flextype/core/Cache.php b/flextype/core/Cache.php index a6192c11..6f3d4ecd 100755 --- a/flextype/core/Cache.php +++ b/flextype/core/Cache.php @@ -358,7 +358,7 @@ class Cache /** * Clear Cache */ - public function clear() : void + public function clear(string $id) : void { // Clear stat cache @clearstatcache(); @@ -367,8 +367,22 @@ class Cache function_exists('opcache_reset') and @opcache_reset(); // Remove cache dirs - Filesystem::deleteDir(PATH['cache'] . '/doctrine/'); - Filesystem::deleteDir(PATH['cache'] . '/glide/'); + Filesystem::deleteDir(PATH['cache'] . '/' . $id); + } + + /** + * Clear ALL Cache + */ + public function clearAll() : void + { + // Clear stat cache + @clearstatcache(); + + // Clear opcache + function_exists('opcache_reset') and @opcache_reset(); + + // Remove cache directory + Filesystem::deleteDir(PATH['cache']); } /**