/
CacheEngineInterface.php
67 lines (63 loc) · 2.16 KB
/
CacheEngineInterface.php
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
65
66
67
<?php
/**
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link https://cakephp.org CakePHP(tm) Project
* @since 3.7.0
* @license https://opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Cache;
/**
* Interface for cache engines that defines methods
* outside of the PSR16 interface that are used by `Cache`.
*
* Internally Cache uses this interface when calling engine
* methods.
*
* @since 3.7.0
*/
interface CacheEngineInterface
{
/**
* Write data for key into a cache engine if it doesn't exist already.
*
* @param string $key Identifier for the data.
* @param mixed $value Data to be cached - anything except a resource.
* @return bool True if the data was successfully cached, false on failure.
* Or if the key existed already.
*/
public function add($key, $value);
/**
* Increment a number under the key and return incremented value
*
* @param string $key Identifier for the data
* @param int $offset How much to add
* @return bool|int New incremented value, false otherwise
*/
public function increment($key, $offset = 1);
/**
* Decrement a number under the key and return decremented value
*
* @param string $key Identifier for the data
* @param int $offset How much to subtract
* @return bool|int New incremented value, false otherwise
*/
public function decrement($key, $offset = 1);
/**
* Clear all values belonging to the named group.
*
* Each implementation needs to decide whether actually
* delete the keys or just augment a group generation value
* to achieve the same result.
*
* @param string $group name of the group to be cleared
* @return bool
*/
public function clearGroup($group);
}