mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-06-25 20:34:22 +02:00
feat(sqlite cache): add config options (#3499)
* refactor: sqlite cache * refactor * feat: add config options to sqlite cache * refactor
This commit is contained in:
@ -51,7 +51,26 @@ class CacheFactory
|
||||
}
|
||||
return new FileCache($fileCacheConfig);
|
||||
case SQLiteCache::class:
|
||||
return new SQLiteCache();
|
||||
if (!extension_loaded('sqlite3')) {
|
||||
throw new \Exception('"sqlite3" extension not loaded. Please check "php.ini"');
|
||||
}
|
||||
if (!is_writable(PATH_CACHE)) {
|
||||
throw new \Exception('The cache folder is not writable');
|
||||
}
|
||||
$file = Configuration::getConfig('SQLiteCache', 'file');
|
||||
if (!$file) {
|
||||
throw new \Exception(sprintf('Configuration for %s missing.', 'SQLiteCache'));
|
||||
}
|
||||
if (dirname($file) == '.') {
|
||||
$file = PATH_CACHE . $file;
|
||||
} elseif (!is_dir(dirname($file))) {
|
||||
throw new \Exception(sprintf('Invalid configuration for %s', 'SQLiteCache'));
|
||||
}
|
||||
return new SQLiteCache([
|
||||
'file' => $file,
|
||||
'timeout' => Configuration::getConfig('SQLiteCache', 'timeout'),
|
||||
'enable_purge' => Configuration::getConfig('SQLiteCache', 'enable_purge'),
|
||||
]);
|
||||
case MemcachedCache::class:
|
||||
return new MemcachedCache();
|
||||
default:
|
||||
|
Reference in New Issue
Block a user