| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273 | 
							- <?php
 
- /**
 
-  *
 
-  * Cube Framework $Id$ LKzi3HZ/M17qHTD/gVJs23m3hNyTCrKYHLjTtFPRsdI=
 
-  *
 
-  * @link        http://codecu.be/framework
 
-  * @copyright   Copyright (c) 2017 CodeCube SRL
 
-  * @license     http://codecu.be/framework/license Commercial License
 
-  *
 
-  * @version     1.10 [rev.1.10.02]
 
-  */
 
- namespace Cube\Cache\Adapter;
 
- abstract class AbstractAdapter
 
- {
 
-     /**
 
-      * cache types
 
-      */
 
-     const ROUTES = 'routes';
 
-     const METADATA = 'metadata';
 
-     const QUERIES = 'queries';
 
-     /**
 
-      * used for cached queries
 
-      */
 
-     const CACHE_COL = 'cache_col';
 
-     const CACHE_WHERE = 'cache_where';
 
-     /**
 
-      *
 
-      * whether to cache select queries
 
-      *
 
-      * @var bool
 
-      */
 
-     protected $_cacheQueries = false;
 
-     /**
 
-      *
 
-      * whether to cache table metadatas
 
-      *
 
-      * @var bool
 
-      */
 
-     protected $_cacheMetadata = true;
 
-     /**
 
-      *
 
-      * whether to cache routes
 
-      *
 
-      * @var bool
 
-      */
 
-     protected $_cacheRoutes = false;
 
-     /**
 
-      *
 
-      * whether to serialize data upon read and write
 
-      *
 
-      * @var bool
 
-      */
 
-     protected $_serialization = true;
 
-     /**
 
-      *
 
-      * number of seconds after a cached variable expires
 
-      *
 
-      * @var integer
 
-      */
 
-     protected $_expires = 259200; // 3 days
 
-     /**
 
-      *
 
-      * class constructor
 
-      *
 
-      * @param array $options configuration array
 
-      */
 
-     public function __construct($options = array())
 
-     {
 
-         if (isset($options['queries'])) {
 
-             $this->setCacheQueries($options['queries']);
 
-         }
 
-         if (isset($options['metadata'])) {
 
-             $this->setCacheMetadata($options['metadata']);
 
-         }
 
-         if (isset($options['routes'])) {
 
-             $this->setCacheRoutes($options['routes']);
 
-         }
 
-         if (isset($options['serialization'])) {
 
-             $this->setSerialization($options['serialization']);
 
-         }
 
-     }
 
-     /**
 
-      *
 
-      * get cache queries flag
 
-      *
 
-      * @return bool
 
-      */
 
-     public function getCacheQueries()
 
-     {
 
-         return $this->_cacheQueries;
 
-     }
 
-     /**
 
-      *
 
-      * set cache queries flag
 
-      *
 
-      * @param bool $cacheQueries
 
-      *
 
-      * @return $this
 
-      */
 
-     public function setCacheQueries($cacheQueries)
 
-     {
 
-         $this->_cacheQueries = $cacheQueries;
 
-         return $this;
 
-     }
 
-     /**
 
-      *
 
-      * get cache metadata flag
 
-      *
 
-      * @return bool
 
-      */
 
-     public function getCacheMetadata()
 
-     {
 
-         return $this->_cacheMetadata;
 
-     }
 
-     /**
 
-      *
 
-      * set cache metadata flag
 
-      *
 
-      * @param bool $cacheMetadata
 
-      *
 
-      * @return $this
 
-      */
 
-     public function setCacheMetadata($cacheMetadata)
 
-     {
 
-         $this->_cacheMetadata = (bool)$cacheMetadata;
 
-         return $this;
 
-     }
 
-     /**
 
-      *
 
-      * get cache routes flag
 
-      *
 
-      * @return bool
 
-      */
 
-     public function getCacheRoutes()
 
-     {
 
-         return $this->_cacheRoutes;
 
-     }
 
-     /**
 
-      *
 
-      * set cache routes flag
 
-      *
 
-      * @param bool $cacheRoutes
 
-      *
 
-      * @return $this
 
-      */
 
-     public function setCacheRoutes($cacheRoutes)
 
-     {
 
-         $this->_cacheRoutes = (bool)$cacheRoutes;
 
-         return $this;
 
-     }
 
-     /**
 
-      *
 
-      * get serialization flag
 
-      *
 
-      * @return bool
 
-      */
 
-     public function getSerialization()
 
-     {
 
-         return $this->_serialization;
 
-     }
 
-     /**
 
-      *
 
-      * set serialization flag
 
-      *
 
-      * @param bool $serialization
 
-      *
 
-      * @return $this
 
-      */
 
-     public function setSerialization($serialization)
 
-     {
 
-         $this->_serialization = (bool)$serialization;
 
-         return $this;
 
-     }
 
-     /**
 
-      *
 
-      * get expiration time
 
-      *
 
-      * @return int
 
-      */
 
-     public function getExpires()
 
-     {
 
-         return $this->_expires;
 
-     }
 
-     /**
 
-      *
 
-      * set expiration time
 
-      *
 
-      * @param int $expires
 
-      *
 
-      * @return $this
 
-      */
 
-     public function setExpires($expires)
 
-     {
 
-         $this->_expires = (int)$expires;
 
-         return $this;
 
-     }
 
-     /**
 
-      *
 
-      * read from cache
 
-      *
 
-      * @param string $name
 
-      * @param string $type
 
-      */
 
-     abstract public function read($name, $type);
 
-     /**
 
-      *
 
-      * write to cache
 
-      *
 
-      * @param string $name
 
-      * @param string $type
 
-      * @param mixed  $data
 
-      * @param int    $expires
 
-      */
 
-     abstract public function write($name, $type, $data, $expires = null);
 
-     /**
 
-      *
 
-      * delete variable from cache
 
-      *
 
-      * @param string $name
 
-      * @param string $type
 
-      */
 
-     abstract public function delete($name, $type);
 
-     /**
 
-      *
 
-      * purge cached variables
 
-      *
 
-      * @param string  $type
 
-      * @param boolean $force
 
-      */
 
-     abstract public function purge($type, $force = false);
 
-     /**
 
-      *
 
-      * clear cache
 
-      */
 
-     abstract public function clear();
 
- }
 
 
  |