1: <?php
2: /*
3: You may not change or alter any portion of this comment or credits
4: of supporting developers from this source code or any supporting source code
5: which is considered copyrighted (c) material of the original comment or credit authors.
6:
7: This program is distributed in the hope that it will be useful,
8: but WITHOUT ANY WARRANTY; without even the implied warranty of
9: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10: */
11:
12: namespace Xmf\Key;
13:
14: /**
15: * Xmf\Key\StorageInterface
16: *
17: * load a database table
18: *
19: * @category Xmf\Key\StorageInterface
20: * @package Xmf
21: * @author Richard Griffith <richard@geekwright.com>
22: * @copyright 2018 XOOPS Project (https://xoops.org)
23: * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html)
24: * @link https://xoops.org
25: */
26: interface StorageInterface
27: {
28: /**
29: * Save key data by name
30: *
31: * @param string $name key name
32: * @param string $data key data, serialized to string if required
33: *
34: * @return boolean true if key saved, otherwise false
35: */
36: public function save($name, $data);
37:
38: /**
39: * Fetch key data by name
40: *
41: * @param string $name key name
42: *
43: * @return string|false key data (possibly serialized) or false on error
44: */
45: public function fetch($name);
46:
47: /**
48: * Fetch key data by name
49: *
50: * @param string $name key name
51: *
52: * @return boolean true if key exists, otherwise false
53: */
54: public function exists($name);
55:
56: /**
57: * Delete a key
58: *
59: * @param string $name key name
60: *
61: * @return boolean true if key deleted, otherwise false
62: */
63: public function delete($name);
64: }
65: