From 0998cbde9d5edca546149320c5af2c7da17e2775 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Sat, 8 Oct 2016 14:52:03 +0200 Subject: [PATCH] [cache] Directly implement CacheInterface in FileCache The function 'prepare' previously implemented in CacheAbstract is specifically required for FileCache and thus belongs to FileCache. Since this change removes all code from CacheAbstract, it can be removed completely. --- caches/FileCache.php | 10 +++++++++- lib/BridgeAbstract.php | 2 +- lib/CacheAbstract.php | 11 ----------- lib/RssBridge.php | 1 - 4 files changed, 10 insertions(+), 14 deletions(-) delete mode 100644 lib/CacheAbstract.php diff --git a/caches/FileCache.php b/caches/FileCache.php index fc152b1..7878d34 100644 --- a/caches/FileCache.php +++ b/caches/FileCache.php @@ -2,7 +2,9 @@ /** * Cache with file system */ -class FileCache extends CacheAbstract { +class FileCache implements CacheInterface { + + protected $param; public function loadData(){ $this->isPrepareCache(); @@ -53,6 +55,12 @@ class FileCache extends CacheAbstract { } } + public function prepare(array $param){ + $this->param = $param; + + return $this; + } + /** * Cache is prepared ? * Note : Cache name is based on request information, then cache must be prepare before use diff --git a/lib/BridgeAbstract.php b/lib/BridgeAbstract.php index 2a64832..90e997c 100644 --- a/lib/BridgeAbstract.php +++ b/lib/BridgeAbstract.php @@ -196,7 +196,7 @@ abstract class BridgeAbstract implements BridgeInterface { return static::URI; } - public function setCache(\CacheAbstract $cache){ + public function setCache(\CacheInterface $cache){ $this->cache = $cache; } } diff --git a/lib/CacheAbstract.php b/lib/CacheAbstract.php deleted file mode 100644 index e6c39d8..0000000 --- a/lib/CacheAbstract.php +++ /dev/null @@ -1,11 +0,0 @@ -param = $param; - - return $this; - } -} diff --git a/lib/RssBridge.php b/lib/RssBridge.php index 0052abc..37992d3 100644 --- a/lib/RssBridge.php +++ b/lib/RssBridge.php @@ -14,7 +14,6 @@ require __DIR__ . '/Bridge.php'; require __DIR__ . '/BridgeAbstract.php'; require __DIR__ . '/FeedExpander.php'; require __DIR__ . '/Cache.php'; -require __DIR__ . '/CacheAbstract.php'; require __DIR__ . '/validation.php'; require __DIR__ . '/html.php';