Advertisement
stixlink

ManageCache

Jul 10th, 2014
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.85 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * Created by PhpStorm.
  5.  * User: Stixlink
  6.  * Date: 10.07.14
  7.  * Time: 19:38
  8.  */
  9.  
  10. namespace services;
  11.  
  12.  
  13. require_once('/../interfaces/ICache.php');
  14. use interfaces\ICache;
  15.  
  16. class ManageCache implements ICache {
  17.  
  18.     private $_cache;
  19.  
  20.     public function __construct(ICache $cache) {
  21.  
  22.         $this->_cache = $cache;
  23.     }
  24.  
  25.     /**
  26.      * @param string $key
  27.      *
  28.      * @return mixed
  29.      */
  30.     public function get($key) {
  31.  
  32.         return $this->_cache->get($key);
  33.     }
  34.  
  35.     /**
  36.      * @param string $key
  37.      * @param mixed  $value
  38.      * @param int    $duration
  39.      */
  40.     public function set($key, $value, $duration = 3600) {
  41.  
  42.         $this->_cache->set($key, $value, $duration);
  43.     }
  44.  
  45.     /**
  46.      * @param string $key
  47.      */
  48.     public function delete($key) {
  49.  
  50.         $this->_cache->delete($key);
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement