1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* |
4
|
|
|
* This file is part of phpFastCache. |
5
|
|
|
* |
6
|
|
|
* @license MIT License (MIT) |
7
|
|
|
* |
8
|
|
|
* For full copyright and license information, please see the docs/CREDITS.txt file. |
9
|
|
|
* |
10
|
|
|
* @author Khoa Bui (khoaofgod) <[email protected]> http://www.phpfastcache.com |
11
|
|
|
* @author Georges.L (Geolim4) <[email protected]> |
12
|
|
|
* |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
namespace phpFastCache\Core; |
16
|
|
|
|
17
|
|
|
use phpFastCache\Cache\DriverBaseTrait; |
18
|
|
|
use phpFastCache\Cache\ExtendedCacheItemPoolInterface; |
19
|
|
|
use Psr\Cache\CacheItemInterface; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Class DriverAbstract |
23
|
|
|
* @package phpFastCache\Core |
24
|
|
|
*/ |
25
|
|
|
abstract class DriverAbstract implements ExtendedCacheItemPoolInterface |
26
|
|
|
{ |
27
|
|
|
use ExtendedCacheItemPoolTrait; |
28
|
|
|
use DriverBaseTrait; |
29
|
|
|
|
30
|
|
|
const DRIVER_CHECK_FAILURE = '%s is not installed or is misconfigured, cannot continue.'; |
31
|
|
|
const DRIVER_TAGS_KEY_PREFIX = '_TAG_'; |
32
|
|
|
const DRIVER_DATA_WRAPPER_INDEX = 'd'; |
33
|
|
|
const DRIVER_TIME_WRAPPER_INDEX = 't'; |
34
|
|
|
const DRIVER_TAGS_WRAPPER_INDEX = 'g'; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @param string $key |
38
|
|
|
* @return array [ |
39
|
|
|
* 'd' => 'THE ITEM DATA' |
40
|
|
|
* 't' => 'THE ITEM DATE EXPIRATION' |
41
|
|
|
* 'g' => 'THE ITEM TAGS' |
42
|
|
|
* ] |
43
|
|
|
* |
44
|
|
|
*/ |
45
|
|
|
abstract public function driverRead($key); |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @param \Psr\Cache\CacheItemInterface $item |
49
|
|
|
* @return mixed |
50
|
|
|
*/ |
51
|
|
|
abstract public function driverWrite(CacheItemInterface $item); |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @return bool |
55
|
|
|
*/ |
56
|
|
|
abstract public function driverClear(); |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @return bool |
60
|
|
|
*/ |
61
|
|
|
abstract public function driverConnect(); |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @param \Psr\Cache\CacheItemInterface $item |
65
|
|
|
* @return bool |
66
|
|
|
*/ |
67
|
|
|
abstract public function driverDelete(CacheItemInterface $item); |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @param \Psr\Cache\CacheItemInterface $item |
71
|
|
|
* @return bool |
72
|
|
|
*/ |
73
|
|
|
abstract public function driverIsHit(CacheItemInterface $item); |
74
|
|
|
|
75
|
|
|
} |