1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ByJG\Cache\Psr16; |
4
|
|
|
|
5
|
|
|
use ByJG\Cache\CacheLockInterface; |
6
|
|
|
|
7
|
|
|
class NoCacheEngine extends BaseCacheEngine implements CacheLockInterface |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* @param string $key The object KEY |
11
|
|
|
* @param int $default IGNORED IN MEMCACHED. |
12
|
|
|
* @return mixed Description |
13
|
|
|
*/ |
14
|
|
|
public function get($key, $default = null) |
15
|
|
|
{ |
16
|
|
|
return $default; |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @param string $key The object Key |
21
|
|
|
* @param object $value The object to be cached |
22
|
|
|
* @param int $ttl The time to live in seconds of this objects |
23
|
|
|
* @return bool If the object is successfully posted |
24
|
|
|
*/ |
25
|
|
|
public function set($key, $value, $ttl = 0) |
26
|
|
|
{ |
27
|
|
|
return true; |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @param string $key |
32
|
|
|
* @return bool |
33
|
|
|
*/ |
34
|
|
|
public function delete($key) |
35
|
|
|
{ |
36
|
|
|
return true; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Lock resource before set it. |
41
|
|
|
* @param string $key |
42
|
|
|
*/ |
43
|
|
|
public function lock($key) |
44
|
|
|
{ |
45
|
|
|
return; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* UnLock resource after set it |
50
|
|
|
* @param string $key |
51
|
|
|
*/ |
52
|
|
|
public function unlock($key) |
53
|
|
|
{ |
54
|
|
|
return; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function isAvailable() |
58
|
|
|
{ |
59
|
|
|
return true; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Wipes clean the entire cache's keys. |
64
|
|
|
* |
65
|
|
|
* @return bool True on success and false on failure. |
66
|
|
|
*/ |
67
|
|
|
public function clear() |
68
|
|
|
{ |
69
|
|
|
return true; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Determines whether an item is present in the cache. |
74
|
|
|
* NOTE: It is recommended that has() is only to be used for cache warming type purposes |
75
|
|
|
* and not to be used within your live applications operations for get/set, as this method |
76
|
|
|
* is subject to a race condition where your has() will return true and immediately after, |
77
|
|
|
* another script can remove it making the state of your app out of date. |
78
|
|
|
* |
79
|
|
|
* @param string $key The cache item key. |
80
|
|
|
* @return bool |
81
|
|
|
* @throws \Psr\SimpleCache\InvalidArgumentException |
82
|
|
|
* MUST be thrown if the $key string is not a legal value. |
83
|
|
|
*/ |
84
|
|
|
public function has($key) |
85
|
|
|
{ |
86
|
|
|
return false; |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
|