AnalystContract.php
2 weeks ago
CacheContract.php
2 weeks ago
HttpClientContract.php
2 weeks ago
RequestContract.php
2 weeks ago
RequestorContract.php
2 weeks ago
StorageContract.php
2 weeks ago
TrackerContract.php
2 weeks ago
StorageContract.php
41 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Analyst\Contracts; |
| 4 | |
| 5 | if ( ! defined( 'ABSPATH' ) ) exit; |
| 6 | |
| 7 | /** |
| 8 | * Interface StorageContract |
| 9 | * |
| 10 | * Defines a simple key-value persistence layer. |
| 11 | * Implementations may use the database, filesystem, or any other backend. |
| 12 | */ |
| 13 | interface StorageContract |
| 14 | { |
| 15 | /** |
| 16 | * Retrieve a value by key. |
| 17 | * |
| 18 | * @param string $key |
| 19 | * @param mixed $default |
| 20 | * @return mixed |
| 21 | */ |
| 22 | public function get($key, $default = null); |
| 23 | |
| 24 | /** |
| 25 | * Store a value under the given key. |
| 26 | * |
| 27 | * @param string $key |
| 28 | * @param mixed $value |
| 29 | * @return bool |
| 30 | */ |
| 31 | public function put($key, $value); |
| 32 | |
| 33 | /** |
| 34 | * Remove a value by key. |
| 35 | * |
| 36 | * @param string $key |
| 37 | * @return bool |
| 38 | */ |
| 39 | public function delete($key); |
| 40 | } |
| 41 |