Security update for Core, with self-updated composer
[yaffs-website] / vendor / drush / drush / lib / Drush / Cache / CacheInterface.php
1 <?php
2
3 /**
4  * @file
5  * Definition of Drush\Cache\CacheInterface.
6  */
7
8 namespace Drush\Cache;
9
10 /**
11  * Interface for cache implementations.
12  *
13  * All cache implementations have to implement this interface.
14  * JSONCache provides the default implementation, which can be
15  * consulted as an example.
16  *
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:
22  * @code
23  *  $options['cache-class-example'] = 'MyCustomCache;
24  * @endcode
25  *
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.
29  * @code
30  *  $options['cache-default-class'] = 'MyCustomCache;
31  * @endcode
32  *
33  * @see _drush_cache_get_object()
34  * @see \Drupal\Core\Cache\CacheBackendInterface
35  */
36 interface CacheInterface {
37
38 /**
39  * Constructor.
40  *
41  * @param $bin
42  *   The cache bin for which the object is created.
43 */
44 function __construct($bin);
45
46 /**
47  * Return data from the persistent cache.
48  *
49  * @param string $cid
50  *   The cache ID of the data to retrieve.
51  *
52  * @return
53  *   The cache or FALSE on failure.
54  */
55 function get($cid);
56
57 /**
58  * Return data from the persistent cache when given an array of cache IDs.
59  *
60  * @param array $cids
61  *   An array of cache IDs for the data to retrieve. This is passed by
62  *   reference, and will have the IDs successfully returned from cache
63  *   removed.
64  *
65  * @return
66  *   An array of the items successfully returned from cache indexed by cid.
67  */
68 function getMultiple(&$cids);
69
70 /**
71  * Store data in the persistent cache.
72  *
73  * @param string $cid
74  *   The cache ID of the data to store.
75  * @param array $data
76  *   The data to store in the cache.
77  * @param $expire
78  *   One of the following values:
79  *   - DRUSH_CACHE_PERMANENT: Indicates that the item should never be removed unless
80  *     explicitly told to using _drush_cache_clear_all() with a cache ID.
81  *   - DRUSH_CACHE_TEMPORARY: Indicates that the item should be removed at the next
82  *     general cache wipe.
83  *   - A Unix timestamp: Indicates that the item should be kept at least until
84  *     the given time, after which it behaves like CACHE_TEMPORARY.
85  */
86 function set($cid, $data, $expire = DRUSH_CACHE_PERMANENT);
87
88 /**
89  * Expire data from the cache. If called without arguments, expirable
90  * entries will be cleared from all known cache bins.
91  *
92  * @param string $cid
93  *   If set, the cache ID to delete. Otherwise, all cache entries that can
94  *   expire are deleted.
95  * @param bool $wildcard
96  *   If set to TRUE, the $cid is treated as a substring
97  *   to match rather than a complete ID. The match is a right hand
98  *   match. If '*' is given as $cid, the bin $bin will be emptied.
99  */
100 function clear($cid = NULL, $wildcard = FALSE);
101
102 /**
103  * Check if a cache bin is empty.
104  *
105  * A cache bin is considered empty if it does not contain any valid data for
106  * any cache ID.
107  *
108  * @return
109  *   TRUE if the cache bin specified is empty.
110  */
111 function isEmpty();
112 }