Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame^] | 1 | <?php |
| 2 | |
| 3 | namespace Illuminate\Contracts\Cache; |
| 4 | |
| 5 | use Closure; |
| 6 | use Psr\SimpleCache\CacheInterface; |
| 7 | |
| 8 | interface Repository extends CacheInterface |
| 9 | { |
| 10 | /** |
| 11 | * Retrieve an item from the cache and delete it. |
| 12 | * |
| 13 | * @param string $key |
| 14 | * @param mixed $default |
| 15 | * @return mixed |
| 16 | */ |
| 17 | public function pull($key, $default = null); |
| 18 | |
| 19 | /** |
| 20 | * Store an item in the cache. |
| 21 | * |
| 22 | * @param string $key |
| 23 | * @param mixed $value |
| 24 | * @param \DateTimeInterface|\DateInterval|int|null $ttl |
| 25 | * @return bool |
| 26 | */ |
| 27 | public function put($key, $value, $ttl = null); |
| 28 | |
| 29 | /** |
| 30 | * Store an item in the cache if the key does not exist. |
| 31 | * |
| 32 | * @param string $key |
| 33 | * @param mixed $value |
| 34 | * @param \DateTimeInterface|\DateInterval|int|null $ttl |
| 35 | * @return bool |
| 36 | */ |
| 37 | public function add($key, $value, $ttl = null); |
| 38 | |
| 39 | /** |
| 40 | * Increment the value of an item in the cache. |
| 41 | * |
| 42 | * @param string $key |
| 43 | * @param mixed $value |
| 44 | * @return int|bool |
| 45 | */ |
| 46 | public function increment($key, $value = 1); |
| 47 | |
| 48 | /** |
| 49 | * Decrement the value of an item in the cache. |
| 50 | * |
| 51 | * @param string $key |
| 52 | * @param mixed $value |
| 53 | * @return int|bool |
| 54 | */ |
| 55 | public function decrement($key, $value = 1); |
| 56 | |
| 57 | /** |
| 58 | * Store an item in the cache indefinitely. |
| 59 | * |
| 60 | * @param string $key |
| 61 | * @param mixed $value |
| 62 | * @return bool |
| 63 | */ |
| 64 | public function forever($key, $value); |
| 65 | |
| 66 | /** |
| 67 | * Get an item from the cache, or execute the given Closure and store the result. |
| 68 | * |
| 69 | * @param string $key |
| 70 | * @param \DateTimeInterface|\DateInterval|int|null $ttl |
| 71 | * @param \Closure $callback |
| 72 | * @return mixed |
| 73 | */ |
| 74 | public function remember($key, $ttl, Closure $callback); |
| 75 | |
| 76 | /** |
| 77 | * Get an item from the cache, or execute the given Closure and store the result forever. |
| 78 | * |
| 79 | * @param string $key |
| 80 | * @param \Closure $callback |
| 81 | * @return mixed |
| 82 | */ |
| 83 | public function sear($key, Closure $callback); |
| 84 | |
| 85 | /** |
| 86 | * Get an item from the cache, or execute the given Closure and store the result forever. |
| 87 | * |
| 88 | * @param string $key |
| 89 | * @param \Closure $callback |
| 90 | * @return mixed |
| 91 | */ |
| 92 | public function rememberForever($key, Closure $callback); |
| 93 | |
| 94 | /** |
| 95 | * Remove an item from the cache. |
| 96 | * |
| 97 | * @param string $key |
| 98 | * @return bool |
| 99 | */ |
| 100 | public function forget($key); |
| 101 | |
| 102 | /** |
| 103 | * Get the cache store implementation. |
| 104 | * |
| 105 | * @return \Illuminate\Contracts\Cache\Store |
| 106 | */ |
| 107 | public function getStore(); |
| 108 | } |