blob: 133bc43e9f1bd8f29e3c1cb0831e764b246d3d00 [file] [log] [blame]
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001<?php
2
3namespace Illuminate\Contracts\Cache;
4
5interface Store
6{
7 /**
8 * Retrieve an item from the cache by key.
9 *
10 * @param string|array $key
11 * @return mixed
12 */
13 public function get($key);
14
15 /**
16 * Retrieve multiple items from the cache by key.
17 *
18 * Items not found in the cache will have a null value.
19 *
20 * @param array $keys
21 * @return array
22 */
23 public function many(array $keys);
24
25 /**
26 * Store an item in the cache for a given number of seconds.
27 *
28 * @param string $key
29 * @param mixed $value
30 * @param int $seconds
31 * @return bool
32 */
33 public function put($key, $value, $seconds);
34
35 /**
36 * Store multiple items in the cache for a given number of seconds.
37 *
38 * @param array $values
39 * @param int $seconds
40 * @return bool
41 */
42 public function putMany(array $values, $seconds);
43
44 /**
45 * Increment the value of an item in the cache.
46 *
47 * @param string $key
48 * @param mixed $value
49 * @return int|bool
50 */
51 public function increment($key, $value = 1);
52
53 /**
54 * Decrement the value of an item in the cache.
55 *
56 * @param string $key
57 * @param mixed $value
58 * @return int|bool
59 */
60 public function decrement($key, $value = 1);
61
62 /**
63 * Store an item in the cache indefinitely.
64 *
65 * @param string $key
66 * @param mixed $value
67 * @return bool
68 */
69 public function forever($key, $value);
70
71 /**
72 * Remove an item from the cache.
73 *
74 * @param string $key
75 * @return bool
76 */
77 public function forget($key);
78
79 /**
80 * Remove all items from the cache.
81 *
82 * @return bool
83 */
84 public function flush();
85
86 /**
87 * Get the cache key prefix.
88 *
89 * @return string
90 */
91 public function getPrefix();
92}