5 * Definition of Drush\Cache\CacheInterface.
11 * Interface for cache implementations.
13 * All cache implementations have to implement this interface.
14 * JSONCache provides the default implementation, which can be
15 * consulted as an example.
17 * To make Drush use your implementation for a certain cache bin, you have to
18 * set a variable with the name of the cache bin as its key and the name of
19 * your class as its value. For example, if your implementation of
20 * CacheInterface was called MyCustomCache, the following line in
21 * drushrc.php would make Drush use it for the 'example' bin:
23 * $options['cache-class-example'] = 'MyCustomCache;
26 * Additionally, you can register your cache implementation to be used by
27 * default for all cache bins by setting the option 'cache-default-class' to
28 * the name of your implementation of the CacheInterface, e.g.
30 * $options['cache-default-class'] = 'MyCustomCache;
33 * @see \Drupal\Core\Cache\CacheBackendInterface
37 interface CacheInterface
44 * The cache bin for which the object is created.
46 public function __construct($bin);
49 * Return data from the persistent cache.
52 * The cache ID of the data to retrieve.
55 * The cache or FALSE on failure.
57 public function get($cid);
60 * Return data from the persistent cache when given an array of cache IDs.
63 * An array of cache IDs for the data to retrieve. This is passed by
64 * reference, and will have the IDs successfully returned from cache
68 * An array of the items successfully returned from cache indexed by cid.
70 public function getMultiple(&$cids);
73 * Store data in the persistent cache.
76 * The cache ID of the data to store.
78 * The data to store in the cache.
80 * One of the following values:
81 * - DRUSH_CACHE_PERMANENT: Indicates that the item should never be removed unless
82 * explicitly told to using _drush_cache_clear_all() with a cache ID.
83 * - DRUSH_CACHE_TEMPORARY: Indicates that the item should be removed at the next
85 * - A Unix timestamp: Indicates that the item should be kept at least until
86 * the given time, after which it behaves like CACHE_TEMPORARY.
88 public function set($cid, $data, $expire = DRUSH_CACHE_PERMANENT);
91 * Expire data from the cache. If called without arguments, expirable
92 * entries will be cleared from all known cache bins.
95 * If set, the cache ID to delete. Otherwise, all cache entries that can
97 * @param bool $wildcard
98 * If set to TRUE, the $cid is treated as a substring
99 * to match rather than a complete ID. The match is a right hand
100 * match. If '*' is given as $cid, the bin $bin will be emptied.
102 public function clear($cid = null, $wildcard = false);
105 * Check if a cache bin is empty.
107 * A cache bin is considered empty if it does not contain any valid data for
111 * TRUE if the cache bin specified is empty.
113 public function isEmpty();