Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2013 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); |
| 19 | * |
| 20 | * @author Lionel Lecaque <lionel@taotesting.com> |
| 21 | * @license GPLv2 |
| 22 | * @package generis |
| 23 | |
| 24 | * |
| 25 | */ |
| 26 | |
| 27 | /** |
| 28 | * Interface of drivers that provide the Kay Value Persistence |
| 29 | * |
| 30 | * @author Joel Bout <joel@taotesting.com> |
| 31 | */ |
| 32 | interface common_persistence_KvDriver extends common_persistence_Driver |
| 33 | { |
| 34 | /** |
| 35 | * Stores a value, implementing time to live and nx is optional |
| 36 | * Should throw an exception if an option is not supported |
| 37 | * |
| 38 | * @param string $id |
| 39 | * @param string $value |
| 40 | * @param string $ttl time to live in seconds |
| 41 | * @param bool $nx Only set the key if it does not already exist |
| 42 | * @return bool |
| 43 | */ |
| 44 | public function set($id, $value, $ttl = null, $nx = false); |
| 45 | |
| 46 | /** |
| 47 | * Returns a value from storage |
| 48 | * or false if not found |
| 49 | * |
| 50 | * @param string $id |
| 51 | * @return string |
| 52 | */ |
| 53 | public function get($id); |
| 54 | |
| 55 | /** |
| 56 | * test whenever or not an entry exists |
| 57 | * |
| 58 | * @param string $id |
| 59 | * @return boolean |
| 60 | */ |
| 61 | public function exists($id); |
| 62 | |
| 63 | /** |
| 64 | * Remove an entry from storage |
| 65 | * |
| 66 | * @param string $id |
| 67 | * @return boolean |
| 68 | */ |
| 69 | public function del($id); |
| 70 | |
| 71 | /** |
| 72 | * Increment value |
| 73 | * |
| 74 | * @param string $id |
| 75 | * @return boolean |
| 76 | */ |
| 77 | public function incr($id); |
| 78 | |
| 79 | /** |
| 80 | * Decrement value |
| 81 | * @param $id |
| 82 | * @return boolean |
| 83 | */ |
| 84 | public function decr($id); |
| 85 | } |