Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
1 | <?php |
2 | /** |
3 | * Pop PHP Framework (http://www.popphp.org/) |
4 | * |
5 | * @link https://github.com/popphp/popphp-framework |
6 | * @author Nick Sagona, III <dev@nolainteractive.com> |
7 | * @copyright Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com) |
8 | * @license http://www.popphp.org/license New BSD License |
9 | */ |
10 | |
11 | /** |
12 | * @namespace |
13 | */ |
14 | namespace Pop\Cache\Adapter; |
15 | |
16 | /** |
17 | * Cache adapter interface |
18 | * |
19 | * @category Pop |
20 | * @package Pop\Cache |
21 | * @author Nick Sagona, III <dev@nolainteractive.com> |
22 | * @copyright Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com) |
23 | * @license http://www.popphp.org/license New BSD License |
24 | * @version 4.0.0 |
25 | */ |
26 | interface AdapterInterface |
27 | { |
28 | |
29 | /** |
30 | * Set the global time-to-live for the cache adapter |
31 | * |
32 | * @param int $ttl |
33 | * @return AdapterInterface |
34 | */ |
35 | public function setTtl(int $ttl): AdapterInterface; |
36 | |
37 | /** |
38 | * Get the global time-to-live for the cache object |
39 | * |
40 | * @return int |
41 | */ |
42 | public function getTtl(): int; |
43 | |
44 | /** |
45 | * Get the time-to-live for an item in cache |
46 | * |
47 | * @param string $id |
48 | * @return int |
49 | */ |
50 | public function getItemTtl(string $id): int; |
51 | |
52 | /** |
53 | * Save an item to cache |
54 | * |
55 | * @param string $id |
56 | * @param mixed $value |
57 | * @param ?int $ttl |
58 | * @return AdapterInterface |
59 | */ |
60 | public function saveItem(string $id, mixed $value, ?int $ttl = null): AdapterInterface; |
61 | |
62 | /** |
63 | * Get an item from cache |
64 | * |
65 | * @param string $id |
66 | * @return mixed |
67 | */ |
68 | public function getItem(string $id): mixed; |
69 | |
70 | /** |
71 | * Determine if the item exist in cache |
72 | * |
73 | * @param string $id |
74 | * @return bool |
75 | */ |
76 | public function hasItem(string $id): bool; |
77 | |
78 | /** |
79 | * Delete a value in cache |
80 | * |
81 | * @param string $id |
82 | * @return AdapterInterface |
83 | */ |
84 | public function deleteItem(string $id): AdapterInterface; |
85 | |
86 | /** |
87 | * Clear all stored values from cache |
88 | * |
89 | * @return AdapterInterface |
90 | */ |
91 | public function clear(): AdapterInterface; |
92 | |
93 | /** |
94 | * Destroy cache resource |
95 | * |
96 | * @return AdapterInterface |
97 | */ |
98 | public function destroy(): AdapterInterface; |
99 | |
100 | } |