Cache
Cache copied to clipboard
Unable to clear the cache
I am getting following error.
PHP Fatal error: Uncaught Desarrolla2\Cache\Exception\CacheException: not ready yet in vendor/desarrolla2/cache/src/Adapter/AbstractAdapter.php:61
It looks like it is not implemented yet.
I quickly made removing the cache for file cache. It just gets all cache files and removes if ttl is expired. I added this function to file adapter.
public function cacheClear()
{
$files = glob($this->cacheDir.'{*'.self::CACHE_FILE_SUBFIX.'}',GLOB_BRACE);
$count = count($files);
for($i = 0 ; $i < $count ; $i++)
{
$data = $this->unpack(file_get_contents($files[$i]));
if($this->ttlHasExpired($data['ttl']))
{
$this->deleteFile($files[$i]);
}
unset($files[$i]);
}
return true;
}
Can you send a PR?