Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / memcache / src / DrupalMemcacheInterface.php
1 <?php
2
3 namespace Drupal\memcache;
4
5 /**
6  * Class DrupalMemcacheInterface.
7  */
8 interface DrupalMemcacheInterface {
9
10   /**
11    * Adds an item into memcache.
12    *
13    * @param string $key
14    *   The string with which you will retrieve this item later.
15    * @param mixed $value
16    *   The item to be stored.
17    * @param int $exp
18    *   Parameter expire is expiration time in seconds. If it's 0, the item never
19    *   expires (but memcached server doesn't guarantee this item to be stored
20    *   all the time, it could be deleted from the cache to make place for other
21    *   items).
22    * @param bool $flag
23    *   If using the older memcache PECL extension as opposed to the newer
24    *   memcached PECL extension, the MEMCACHE_COMPRESSED flag can be set to use
25    *   zlib to store a compressed copy of the item.  This flag option is
26    *   completely ignored when using the newer memcached PECL extension.
27    *
28    * @return bool
29    *   Whether or not the add was successful.
30    */
31   public function set($key, $value, $exp = 0, $flag = FALSE);
32
33   /**
34    * Retrieves a value from Memcache.
35    *
36    * @param string $key
37    *   The key with which the item was stored.
38    *
39    * @return mixed
40    *   The item that was originally saved, or FALSE otherwise.
41    */
42   public function get($key);
43
44   /**
45    * Retrieves multiple values from Memcache.
46    *
47    * @param array $keys
48    *   An array of keys for items to retrieve.
49    *
50    * @return array
51    *   An array of stored items, or FALSE otherwise.
52    */
53   public function getMulti(array $keys);
54
55   /**
56    * Deletes an item from Memcache.
57    *
58    * @param string $key
59    *   The key to delete from storage.
60    *
61    * @return bool
62    *   TRUE on success or FALSE on failure.
63    */
64   public function delete($key);
65
66   /**
67    * Add an item to Memcache if it doesn't exist already.
68    *
69    * @param string $key
70    *   The key to add.
71    * @param mixed $value
72    *   The value to add.
73    * @param int $expire
74    *   The expiration time in seconds.
75    *
76    * @return bool
77    *   TRUE on success or FALSE on failure.
78    */
79   public function add($key, $value, $expire = 0);
80
81   /**
82    * Prepares the memcache key.
83    *
84    * @param string $key
85    *   The raw cache key.
86    *
87    * @return string
88    *   The prepared cache key.
89    */
90   public function key($key);
91
92   /**
93    * Immediately invalidates all existing items.
94    *
95    * Flush doesn't actually free any resources, it only marks all the
96    * items as expired, so occupied memory will be overwritten by new items.
97    *
98    * @return bool
99    *   TRUE on success or FALSE on failure.
100    */
101   public function flush();
102
103 }