getKeys(array($key)); return idx($map, $key, $default); } /** * Set a single key in cache. See @{method:setKeys} to set multiple keys at * once. * * See @{method:setKeys} for a description of TTLs. * * @param string $key Key to set. * @param mixed $value Value to set. * @param int|null $ttl (optional) TTL. * @return $this * @task kvimpl */ final public function setKey($key, $value, $ttl = null) { return $this->setKeys(array($key => $value), $ttl); } /** * Delete a key from the cache. See @{method:deleteKeys} to delete multiple * keys at once. * * @param string $key Key to delete. * @return $this * @task kvimpl */ final public function deleteKey($key) { return $this->deleteKeys(array($key)); } /** * Get data from the cache. * * @param list $keys List of cache keys to retrieve. * @return array Dictionary of keys that were found in the * cache. Keys not present in the cache are * omitted, so you can detect a cache miss. * @task kvimpl */ abstract public function getKeys(array $keys); /** * Put data into the key-value cache. * * With a TTL ("time to live"), the cache will automatically delete the key * after a specified number of seconds. By default, there is no expiration * policy and data will persist in cache indefinitely. * * @param array $keys Map of cache keys to values. * @param int|null $ttl (optional) TTL for cache keys, in seconds. * @return $this * @task kvimpl */ abstract public function setKeys(array $keys, $ttl = null); /** * Delete a list of keys from the cache. * * @param list $keys List of keys to delete. * @return $this * @task kvimpl */ abstract public function deleteKeys(array $keys); /** * Completely destroy all data in the cache. * * @return $this * @task kvimpl */ abstract public function destroyCache(); }