Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
AbstractDataCache.php
Go to the documentation of this file.
1<?php
2
7
9
21abstract class AbstractDataCache {
22 protected $_root;
23 protected $postfix;
24
25 public function __construct($root, $postfix = '') {
26 $this->setRoot ( $root );
27 $this->postfix = $postfix;
28 }
29
30 public function init() {
31 }
32
39 abstract public function exists($key);
40
41 public function expired($key, $duration) {
42 if ($this->exists ( $key )) {
43 if (\is_int ( $duration ) && $duration !== 0) {
44 return \time () - $this->getTimestamp ( $key ) > $duration;
45 } else {
46 return false;
47 }
48 } else {
49 return true;
50 }
51 }
52
61 abstract public function store($key, $code, $tag = null);
62
63 public function getRoot() {
64 return $this->_root;
65 }
66
71 public function setRoot($_root) {
72 $this->_root = $_root;
73 }
74
81 abstract public function fetch($key);
82
89 abstract public function file_get_contents($key);
90
97 abstract public function getTimestamp($key);
98
103 abstract public function remove($key);
104
108 abstract public function clear();
109
110 abstract public function getCacheFiles($type);
111
112 abstract public function clearCache($type);
113
114 public function getCacheInfo() {
115 return "Cache system is an instance of <b>" . \get_class ( $this ) . "</b>.";
116 }
117
118 abstract public function getEntryKey($key);
119}
This class is responsible for storing Arrays in PHP files.
file_get_contents($key)
return data stored for the given key.
fetch($key)
Fetches data stored for the given key.
clear()
Clears all cache entries.
store($key, $code, $tag=null)
Caches the given data with the given key.
exists($key)
Check if annotation-data for the key has been stored.
getTimestamp($key)
Returns the timestamp of the last cache update for the given key.