You are here

interface DrupalMemcacheInterface in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 modules/memcache/src/DrupalMemcacheInterface.php \Drupal\memcache\DrupalMemcacheInterface

Class DrupalMemcacheInterface.

Hierarchy

Expanded class hierarchy of DrupalMemcacheInterface

All classes that implement DrupalMemcacheInterface

File

modules/memcache/src/DrupalMemcacheInterface.php, line 13
Contains \Drupal\memcache\DrupalMemcacheInterface.

Namespace

Drupal\memcache
View source
interface DrupalMemcacheInterface {

  /**
   * Adds an item into memcache.
   *
   * @param string $key
   *   The string with which you will retrieve this item later.
   * @param mixed $value
   *   The item to be stored.
   * @param int $exp
   *   Parameter expire is expiration time in seconds. If it's 0, the item never
   *   expires (but memcached server doesn't guarantee this item to be stored
   *   all the time, it could be deleted from the cache to make place for other
   *   items).
   * @param bool $flag
   *   If using the older memcache PECL extension as opposed to the newer
   *   memcached PECL extension, the MEMCACHE_COMPRESSED flag can be set to use
   *   zlib to store a compressed copy of the item.  This flag option is
   *   completely ignored when using the newer memcached PECL extension.
   *
   * @return bool
   *   Whether or not the add was successful.
   */
  public function set($key, $value, $exp = 0, $flag = FALSE);

  /**
   * Retrieves a value from Memcache.
   *
   * @param string $key
   *   The key with which the item was stored.
   *
   * @return mixed
   *   The item that was originally saved, or FALSE otherwise.
   */
  public function get($key);

  /**
   * Retrieves multiple values from Memcache.
   *
   * @param array $keys
   *   An array of keys for items to retrieve.
   *
   * @return array
   *   An array of stored items, or FALSE otherwise.
   */
  public function getMulti(array $keys);

  /**
   * Deletes an item from Memcache.
   *
   * @param string $key
   *   The key to delete from storage.
   *
   * @return bool
   *   TRUE on success or FALSE on failure.
   */
  public function delete($key);

  /**
   * Prepares the memcache key.
   *
   * @param string $key
   *   The raw cache key.
   *
   * @return string
   *   The prepared cache key.
   */
  public function key($key);

  /**
   * Immediately invalidates all existing items.
   *
   * flush doesn't actually free any resources, it only marks all the
   * items as expired, so occupied memory will be overwritten by new items.
   *
   * @return bool
   *   TRUE on success or FALSE on failure.
   */
  public function flush();

  /**
   * Adds a memcache server.
   *
   * @param string $server_path
   *   The server path including port.
   * @param bool $persistent
   *   Whether this server connection is persistent or not.
   */
  public function addServer($server_path, $persistent = FALSE);

}

Members

Namesort descending Modifiers Type Description Overrides
DrupalMemcacheInterface::addServer public function Adds a memcache server. 2
DrupalMemcacheInterface::delete public function Deletes an item from Memcache. 1
DrupalMemcacheInterface::flush public function Immediately invalidates all existing items. 1
DrupalMemcacheInterface::get public function Retrieves a value from Memcache. 1
DrupalMemcacheInterface::getMulti public function Retrieves multiple values from Memcache. 2
DrupalMemcacheInterface::key public function Prepares the memcache key. 1
DrupalMemcacheInterface::set public function Adds an item into memcache. 2