Browse Source

[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.
logmanoriginal 7 years ago
parent
commit
0998cbde9d
4 changed files with 10 additions and 14 deletions
  1. 9 1
      caches/FileCache.php
  2. 1 1
      lib/BridgeAbstract.php
  3. 0 11
      lib/CacheAbstract.php
  4. 0 1
      lib/RssBridge.php

+ 9 - 1
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

+ 1 - 1
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;
 	}
 }

+ 0 - 11
lib/CacheAbstract.php

@@ -1,11 +0,0 @@
-<?php
-require_once(__DIR__ . '/CacheInterface.php');
-abstract class CacheAbstract implements CacheInterface {
-	protected $param;
-
-	public function prepare(array $param){
-		$this->param = $param;
-
-		return $this;
-	}
-}

+ 0 - 1
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';