mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-02 09:04:44 +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:
parent
21c8d8775e
commit
965d7d44c5
4 changed files with 69 additions and 54 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue