1: <?php
2: /**
3: * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
4: * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
5: *
6: * Licensed under The MIT License
7: * For full copyright and license information, please see the LICENSE.txt
8: * Redistributions of files must retain the above copyright notice.
9: *
10: * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
11: * @link https://cakephp.org CakePHP(tm) Project
12: * @since 3.7.0
13: * @license https://opensource.org/licenses/mit-license.php MIT License
14: */
15: namespace Cake\Cache;
16:
17: /**
18: * Interface for cache engines that defines methods
19: * outside of the PSR16 interface that are used by `Cache`.
20: *
21: * Internally Cache uses this interface when calling engine
22: * methods.
23: *
24: * @since 3.7.0
25: */
26: interface CacheEngineInterface
27: {
28: /**
29: * Write data for key into a cache engine if it doesn't exist already.
30: *
31: * @param string $key Identifier for the data.
32: * @param mixed $value Data to be cached - anything except a resource.
33: * @return bool True if the data was successfully cached, false on failure.
34: * Or if the key existed already.
35: */
36: public function add($key, $value);
37:
38: /**
39: * Increment a number under the key and return incremented value
40: *
41: * @param string $key Identifier for the data
42: * @param int $offset How much to add
43: * @return bool|int New incremented value, false otherwise
44: */
45: public function increment($key, $offset = 1);
46:
47: /**
48: * Decrement a number under the key and return decremented value
49: *
50: * @param string $key Identifier for the data
51: * @param int $offset How much to subtract
52: * @return bool|int New incremented value, false otherwise
53: */
54: public function decrement($key, $offset = 1);
55:
56: /**
57: * Clear all values belonging to the named group.
58: *
59: * Each implementation needs to decide whether actually
60: * delete the keys or just augment a group generation value
61: * to achieve the same result.
62: *
63: * @param string $group name of the group to be cleared
64: * @return bool
65: */
66: public function clearGroup($group);
67: }
68: