| 1 | <?php |
||
| 10 | class AdapterXcache implements iAdapter |
||
| 11 | { |
||
| 12 | public $installed = false; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * __construct |
||
| 16 | */ |
||
| 17 | public function __construct() |
||
| 18 | { |
||
| 19 | if (extension_loaded('xcache') === true) { |
||
| 20 | $this->installed = true; |
||
| 21 | } |
||
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * get cached-item by key |
||
| 26 | * |
||
| 27 | * @param String $key |
||
| 28 | * |
||
| 29 | * @return mixed |
||
| 30 | */ |
||
| 31 | public function get($key) |
||
| 35 | |||
| 36 | /** |
||
| 37 | * set cache-item ky key => value |
||
| 38 | * |
||
| 39 | * @param string $key |
||
| 40 | * @param mixed $value |
||
| 41 | * |
||
| 42 | * @return bool |
||
| 43 | */ |
||
| 44 | public function set($key, $value) |
||
| 48 | |||
| 49 | /** |
||
| 50 | * set expired |
||
| 51 | * |
||
| 52 | * @param $key |
||
| 53 | * @param $value |
||
| 54 | * @param $ttl |
||
| 55 | * |
||
| 56 | * @return bool |
||
| 57 | */ |
||
| 58 | public function setExpired($key, $value, $ttl) |
||
| 62 | |||
| 63 | /** |
||
| 64 | * remove one cache-item |
||
| 65 | * |
||
| 66 | * @param $key |
||
| 67 | * |
||
| 68 | * @return bool |
||
| 69 | */ |
||
| 70 | public function remove($key) |
||
| 74 | |||
| 75 | /** |
||
| 76 | * remove all cache-items |
||
| 77 | * |
||
| 78 | * @return bool |
||
| 79 | */ |
||
| 80 | public function removeAll() |
||
| 93 | |||
| 94 | /** |
||
| 95 | * exists |
||
| 96 | * |
||
| 97 | * @param $key |
||
| 98 | * |
||
| 99 | * @return bool |
||
| 100 | */ |
||
| 101 | public function exists($key) |
||
| 105 | |||
| 106 | /** |
||
| 107 | * check if cache is installed |
||
| 108 | * |
||
| 109 | * @return boolean |
||
| 110 | */ |
||
| 111 | public function installed() |
||
| 115 | |||
| 116 | } |
||
| 117 |