mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-30 22:59:46 +02:00
cache: Refactor cache factory to non-static class
The cache factory can be based on the abstract factory class if it wasn't static. This allows for higher abstraction and makes future extensions possible. Also, not all parts of RSS-Bridge need to work on the same instance of the factory. References #1001
This commit is contained in:
parent
705b9daa0b
commit
2460b67886
5 changed files with 25 additions and 82 deletions
|
@ -45,7 +45,9 @@ function getContents($url, $header = array(), $opts = array()){
|
|||
Debug::log('Reading contents from "' . $url . '"');
|
||||
|
||||
// Initialize cache
|
||||
$cache = Cache::create(Configuration::getConfig('cache', 'type'));
|
||||
$cacheFac = new CacheFactory();
|
||||
$cacheFac->setWorkingDir(PATH_LIB_CACHES);
|
||||
$cache = $cacheFac->create(Configuration::getConfig('cache', 'type'));
|
||||
$cache->setScope('server');
|
||||
$cache->purgeCache(86400); // 24 hours (forced)
|
||||
|
||||
|
@ -270,7 +272,9 @@ function getSimpleHTMLDOMCached($url,
|
|||
Debug::log('Caching url ' . $url . ', duration ' . $duration);
|
||||
|
||||
// Initialize cache
|
||||
$cache = Cache::create(Configuration::getConfig('cache', 'type'));
|
||||
$cacheFac = new CacheFactory();
|
||||
$cacheFac->setWorkingDir(PATH_LIB_CACHES);
|
||||
$cache = $cacheFac->create(Configuration::getConfig('cache', 'type'));
|
||||
$cache->setScope('pages');
|
||||
$cache->purgeCache(86400); // 24 hours (forced)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue