mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-06 00:27:27 +02:00
feat: add filecache config to enable/disable real purge (#3263)
* refactor: cachefactory * feat: add filecache config to enable/disable real purge * test: fix test
This commit is contained in:
@@ -2,11 +2,13 @@
|
||||
|
||||
class FileCache implements CacheInterface
|
||||
{
|
||||
private array $config;
|
||||
protected $path;
|
||||
protected $key;
|
||||
|
||||
public function __construct()
|
||||
public function __construct(array $config = [])
|
||||
{
|
||||
$this->config = $config;
|
||||
if (!is_writable(PATH_CACHE)) {
|
||||
throw new \Exception('The cache folder is not writeable');
|
||||
}
|
||||
@@ -46,6 +48,10 @@ class FileCache implements CacheInterface
|
||||
|
||||
public function purgeCache($seconds)
|
||||
{
|
||||
if (! $this->config['enable_purge']) {
|
||||
return;
|
||||
}
|
||||
|
||||
$cachePath = $this->getPath();
|
||||
if (!file_exists($cachePath)) {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user