Updated ACL help file, minor styling changes (#1590)
[openemr.git] / vendor / psr / simple-cache / src / CacheInterface.php
blob53ef49fa6aa2bffe6e376b01c89a1b4def20a658
1 <?php
3 namespace Psr\SimpleCache;
5 interface CacheInterface
7 /**
8 * Fetches a value from the cache.
10 * @param string $key The unique key of this item in the cache.
11 * @param mixed $default Default value to return if the key does not exist.
13 * @return mixed The value of the item from the cache, or $default in case of cache miss.
15 * @throws \Psr\SimpleCache\InvalidArgumentException
16 * MUST be thrown if the $key string is not a legal value.
18 public function get($key, $default = null);
20 /**
21 * Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.
23 * @param string $key The key of the item to store.
24 * @param mixed $value The value of the item to store, must be serializable.
25 * @param null|int|DateInterval $ttl Optional. The TTL value of this item. If no value is sent and
26 * the driver supports TTL then the library may set a default value
27 * for it or let the driver take care of that.
29 * @return bool True on success and false on failure.
31 * @throws \Psr\SimpleCache\InvalidArgumentException
32 * MUST be thrown if the $key string is not a legal value.
34 public function set($key, $value, $ttl = null);
36 /**
37 * Delete an item from the cache by its unique key.
39 * @param string $key The unique cache key of the item to delete.
41 * @return bool True if the item was successfully removed. False if there was an error.
43 * @throws \Psr\SimpleCache\InvalidArgumentException
44 * MUST be thrown if the $key string is not a legal value.
46 public function delete($key);
48 /**
49 * Wipes clean the entire cache's keys.
51 * @return bool True on success and false on failure.
53 public function clear();
55 /**
56 * Obtains multiple cache items by their unique keys.
58 * @param iterable $keys A list of keys that can obtained in a single operation.
59 * @param mixed $default Default value to return for keys that do not exist.
61 * @return iterable A list of key => value pairs. Cache keys that do not exist or are stale will have $default as value.
63 * @throws \Psr\SimpleCache\InvalidArgumentException
64 * MUST be thrown if $keys is neither an array nor a Traversable,
65 * or if any of the $keys are not a legal value.
67 public function getMultiple($keys, $default = null);
69 /**
70 * Persists a set of key => value pairs in the cache, with an optional TTL.
72 * @param iterable $values A list of key => value pairs for a multiple-set operation.
73 * @param null|int|DateInterval $ttl Optional. The TTL value of this item. If no value is sent and
74 * the driver supports TTL then the library may set a default value
75 * for it or let the driver take care of that.
77 * @return bool True on success and false on failure.
79 * @throws \Psr\SimpleCache\InvalidArgumentException
80 * MUST be thrown if $values is neither an array nor a Traversable,
81 * or if any of the $values are not a legal value.
83 public function setMultiple($values, $ttl = null);
85 /**
86 * Deletes multiple cache items in a single operation.
88 * @param iterable $keys A list of string-based keys to be deleted.
90 * @return bool True if the items were successfully removed. False if there was an error.
92 * @throws \Psr\SimpleCache\InvalidArgumentException
93 * MUST be thrown if $keys is neither an array nor a Traversable,
94 * or if any of the $keys are not a legal value.
96 public function deleteMultiple($keys);
98 /**
99 * Determines whether an item is present in the cache.
101 * NOTE: It is recommended that has() is only to be used for cache warming type purposes
102 * and not to be used within your live applications operations for get/set, as this method
103 * is subject to a race condition where your has() will return true and immediately after,
104 * another script can remove it making the state of your app out of date.
106 * @param string $key The cache item key.
108 * @return bool
110 * @throws \Psr\SimpleCache\InvalidArgumentException
111 * MUST be thrown if the $key string is not a legal value.
113 public function has($key);