From 4a066dfd1721da17013708f18cb88bf2d077a154 Mon Sep 17 00:00:00 2001 From: Christopher Vagnetoft Date: Sun, 11 Oct 2020 23:44:36 +0200 Subject: [PATCH] Re-enabled nesting --- src/LocalCache.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/LocalCache.php b/src/LocalCache.php index 94498b7..4684d98 100644 --- a/src/LocalCache.php +++ b/src/LocalCache.php @@ -54,8 +54,8 @@ class LocalCache implements CacheInterface protected function getKeyPath(string $key) { $hash = $this->hashKey($key); - // $path = substr($hash, 0, 2) . DIRECTORY_SEPARATOR . substr($hash, 2, 2) . DIRECTORY_SEPARATOR . $hash; - $full = $this->cacheDir . DIRECTORY_SEPARATOR . $this->poolName . DIRECTORY_SEPARATOR . $hash; // $path; + $path = substr($hash, 0, 2) . DIRECTORY_SEPARATOR . substr($hash, 2, 2) . DIRECTORY_SEPARATOR . $hash; + $full = $this->cacheDir . DIRECTORY_SEPARATOR . $this->poolName . DIRECTORY_SEPARATOR . $path; return $full; } @@ -125,12 +125,17 @@ class LocalCache implements CacheInterface */ public function clear() { + /* $items = glob($this->cacheDir.DIRECTORY_SEPARATOR.$this->poolName.DIRECTORY_SEPARATOR."*.info"); foreach ($items as $item) { unlink(substr($item, 0, -5)); unlink($item); } @rmdir($this->cacheDir . DIRECTORY_SEPARATOR . $this->poolName); + */ + + $path = $this->cacheDir . DIRECTORY_SEPARATOR . $this->poolName; + exec("rm -rf ".escapeshellarg($path)); } /** @@ -173,4 +178,4 @@ class LocalCache implements CacheInterface $this->delete($key); } } -} \ No newline at end of file +}