-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCacheInterface.php
More file actions
64 lines (58 loc) · 1.29 KB
/
CacheInterface.php
File metadata and controls
64 lines (58 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* Arikaim
*
* @link http://www.arikaim.com
* @copyright Copyright (c) Konstantin Atanasov <info@arikaim.com>
* @license http://www.arikaim.com/license
*
*/
namespace Arikaim\Core\Interfaces;
/**
* Cache interface
*/
interface CacheInterface
{
/**
* Fetch entry.
*
* @param string $id
* @return mixed|false The cached data or false
*/
public function fetch(string $id);
/**
* Save data into the cache.
*
* @param string $id The cache id.
* @param mixed $data The cache entry/data.
* @param int $lifeTime In minutes
* @return bool true if data was successfully stored in the cache, false otherwise.
*/
public function save(string $id, $data, int $lifeTime = 0): bool;
/**
* Check if cache contains item
*
* @param string $id
* @return bool
*/
public function has(string $id): bool;
/**
* Delete cache entry.
*
* @param string $id cache id.
* @return bool
*/
public function delete(string $id): bool;
/**
* Return cache stats
*
* @return array|null
*/
public function getStats(): ?array;
/**
* Delete all cache items.
*
* @return bool
*/
public function clear(): bool;
}