3 namespace Drupal\memcache;
6 * Class DrupalMemcacheInterface.
8 interface DrupalMemcacheInterface {
11 * Adds an item into memcache.
14 * The string with which you will retrieve this item later.
16 * The item to be stored.
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
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.
29 * Whether or not the add was successful.
31 public function set($key, $value, $exp = 0, $flag = FALSE);
34 * Retrieves a value from Memcache.
37 * The key with which the item was stored.
40 * The item that was originally saved, or FALSE otherwise.
42 public function get($key);
45 * Retrieves multiple values from Memcache.
48 * An array of keys for items to retrieve.
51 * An array of stored items, or FALSE otherwise.
53 public function getMulti(array $keys);
56 * Deletes an item from Memcache.
59 * The key to delete from storage.
62 * TRUE on success or FALSE on failure.
64 public function delete($key);
67 * Add an item to Memcache if it doesn't exist already.
74 * The expiration time in seconds.
77 * TRUE on success or FALSE on failure.
79 public function add($key, $value, $expire = 0);
82 * Prepares the memcache key.
88 * The prepared cache key.
90 public function key($key);
93 * Immediately invalidates all existing items.
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.
99 * TRUE on success or FALSE on failure.
101 public function flush();