3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
17 * CRM_Utils_Cache_Interface is a long-standing interface used within CiviCRM
18 * for interacting with a cache service. In style and substance, it is extremely
19 * similar to PHP-FIG's SimpleCache interface (PSR-16). Consequently, beginning
20 * with CiviCRM v5.4, this extends \Psr\SimpleCache\CacheInterface.
22 * @see https://www.php-fig.org/psr/psr-16/
24 interface CRM_Utils_Cache_Interface
extends \Psr\SimpleCache\CacheInterface
{
27 * Set the value in the cache.
31 * @param null|int|\DateInterval $ttl
34 public function set($key, $value, $ttl = NULL);
37 * Get a value from the cache.
40 * @param mixed $default
42 * The previously set value value, or $default (NULL).
44 public function get($key, $default = NULL);
47 * Delete a value from the cache.
52 public function delete($key);
55 * Delete all values from the cache.
57 * NOTE: flush() and clear() should be aliases. flush() is specified by
58 * Civi's traditional interface, and clear() is specified by PSR-16.
64 public function flush();
67 * Delete all values from the cache.
69 * NOTE: flush() and clear() should be aliases. flush() is specified by
70 * Civi's traditional interface, and clear() is specified by PSR-16.
75 public function clear();
78 * Determines whether an item is present in the cache.
80 * NOTE: It is recommended that has() is only to be used for cache warming type purposes
81 * and not to be used within your live applications operations for get/set, as this method
82 * is subject to a race condition where your has() will return true and immediately after,
83 * another script can remove it making the state of your app out of date.
85 * @param string $key The cache item key.
89 public function has($key);