* @license GPLv2 * @package generis * */ /** * Interface of drivers that provide the Kay Value Persistence * * @author Joel Bout */ interface common_persistence_KvDriver extends common_persistence_Driver { /** * Stores a value, implementing time to live and nx is optional * Should throw an exception if an option is not supported * * @param string $id * @param string $value * @param string $ttl time to live in seconds * @param bool $nx Only set the key if it does not already exist * @return bool */ public function set($id, $value, $ttl = null, $nx = false); /** * Returns a value from storage * or false if not found * * @param string $id * @return string */ public function get($id); /** * test whenever or not an entry exists * * @param string $id * @return boolean */ public function exists($id); /** * Remove an entry from storage * * @param string $id * @return boolean */ public function del($id); /** * Increment value * * @param string $id * @return boolean */ public function incr($id); /** * Decrement value * @param $id * @return boolean */ public function decr($id); }