]> git.mxchange.org Git - friendica.git/blob - src/Core/KeyValueStorage/Capabilities/IManageKeyValuePairs.php
Merge pull request #13019 from MrPetovan/bug/deprecated
[friendica.git] / src / Core / KeyValueStorage / Capabilities / IManageKeyValuePairs.php
1 <?php
2 /**
3  * @copyright Copyright (C) 2010-2023, the Friendica project
4  *
5  * @license GNU AGPL version 3 or any later version
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU Affero General Public License for more details.
16  *
17  * You should have received a copy of the GNU Affero General Public License
18  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19  *
20  */
21
22 namespace Friendica\Core\KeyValueStorage\Capabilities;
23
24 use Friendica\Core\KeyValueStorage\Exceptions\KeyValueStoragePersistenceException;
25
26 /**
27  * Interface for Friendica specific Key-Value pair storage
28  */
29 interface IManageKeyValuePairs extends \ArrayAccess
30 {
31         /**
32          * Get a particular value from the KeyValue Storage
33          *
34          * @param string  $key           The key to query
35          *
36          * @return mixed Stored value or null if it does not exist
37          *
38          * @throws KeyValueStoragePersistenceException In case the persistence layer throws errors
39          *
40          */
41         public function get(string $key);
42
43         /**
44          * Sets a value for a given key
45          *
46          * Note: Please do not store booleans - convert to 0/1 integer values!
47          *
48          * @param string $key    The configuration key to set
49          * @param mixed  $value  The value to store
50          *
51          * @throws KeyValueStoragePersistenceException In case the persistence layer throws errors
52          */
53         public function set(string $key, $value): void;
54
55         /**
56          * Deletes the given key.
57          *
58          * @param string $key    The configuration key to delete
59          *
60          * @throws KeyValueStoragePersistenceException In case the persistence layer throws errors
61          *
62          */
63         public function delete(string $key): void;
64 }