fix: file cache tweaks (#3470)

* fix: improve file cache

* fix(filecache): log when unserialize fails
This commit is contained in:
Dag 2023-06-30 22:31:19 +02:00 committed by GitHub
parent cc91ee1e37
commit 372880b5ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 13 deletions

View file

@ -38,11 +38,18 @@ class CacheFactory
case NullCache::class:
return new NullCache();
case FileCache::class:
return new FileCache([
// Intentionally checking for "truthy" value
$fileCacheConfig = [
// Intentionally checking for truthy value because the historic default value is the empty string
'path' => Configuration::getConfig('FileCache', 'path') ?: PATH_CACHE,
'enable_purge' => Configuration::getConfig('FileCache', 'enable_purge'),
]);
];
if (!is_dir($fileCacheConfig['path'])) {
throw new \Exception(sprintf('The FileCache path does not exists: %s', $fileCacheConfig['path']));
}
if (!is_writable($fileCacheConfig['path'])) {
throw new \Exception(sprintf('The FileCache path is not writable: %s', $fileCacheConfig['path']));
}
return new FileCache($fileCacheConfig);
case SQLiteCache::class:
return new SQLiteCache();
case MemcachedCache::class: