Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CacheEngineInterface and SimpleCacheEngine implementation
Add a new interface for cake specific caching operations. This interface is a sibling to the PSR16 interface and will allow the `Cache` frontend to typehint adapters for non-standard methods in the frontend and allow other methods to typehint on the methods they need.
- Loading branch information
Showing
4 changed files
with
137 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?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 | ||
{ | ||
/** | ||
* 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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters