5 * Contains \Drupal\memcache\DrupalMemcacheInterface.
8 namespace Drupal\memcache;
11 * Class DrupalMemcacheInterface.
13 interface DrupalMemcacheInterface {
16 * Adds an item into memcache.
19 * The string with which you will retrieve this item later.
21 * The item to be stored.
23 * Parameter expire is expiration time in seconds. If it's 0, the item never
24 * expires (but memcached server doesn't guarantee this item to be stored
25 * all the time, it could be deleted from the cache to make place for other
28 * If using the older memcache PECL extension as opposed to the newer
29 * memcached PECL extension, the MEMCACHE_COMPRESSED flag can be set to use
30 * zlib to store a compressed copy of the item. This flag option is
31 * completely ignored when using the newer memcached PECL extension.
34 * Whether or not the add was successful.
36 public function set($key, $value, $exp = 0, $flag = FALSE);
39 * Retrieves a value from Memcache.
42 * The key with which the item was stored.
45 * The item that was originally saved, or FALSE otherwise.
47 public function get($key);
50 * Retrieves multiple values from Memcache.
53 * An array of keys for items to retrieve.
56 * An array of stored items, or FALSE otherwise.
58 public function getMulti(array $keys);
61 * Deletes an item from Memcache.
64 * The key to delete from storage.
67 * TRUE on success or FALSE on failure.
69 public function delete($key);
72 * Prepares the memcache key.
78 * The prepared cache key.
80 public function key($key);
83 * Immediately invalidates all existing items.
85 * flush doesn't actually free any resources, it only marks all the
86 * items as expired, so occupied memory will be overwritten by new items.
89 * TRUE on success or FALSE on failure.
91 public function flush();
94 * Closes the memacache instance connection.
96 public function close();
99 * Adds a memcache server.
101 * @param string $server_path
102 * The server path including port.
103 * @param bool $persistent
104 * Whether this server connection is persistent or not.
106 public function addServer($server_path, $persistent = FALSE);