3 * @copyright Copyright (C) 2010-2023, the Friendica project
5 * @license GNU AGPL version 3 or any later version
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.
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.
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/>.
22 namespace Friendica\Core\KeyValueStorage\Capabilities;
24 use Friendica\Core\KeyValueStorage\Exceptions\KeyValueStoragePersistenceException;
27 * Interface for Friendica specific Key-Value pair storage
29 interface IManageKeyValuePairs extends \ArrayAccess
32 * Get a particular value from the KeyValue Storage
34 * @param string $key The key to query
36 * @return mixed Stored value or null if it does not exist
38 * @throws KeyValueStoragePersistenceException In case the persistence layer throws errors
41 public function get(string $key);
44 * Sets a value for a given key
46 * Note: Please do not store booleans - convert to 0/1 integer values!
48 * @param string $key The configuration key to set
49 * @param mixed $value The value to store
51 * @throws KeyValueStoragePersistenceException In case the persistence layer throws errors
53 public function set(string $key, $value): void;
56 * Deletes the given key.
58 * @param string $key The configuration key to delete
60 * @throws KeyValueStoragePersistenceException In case the persistence layer throws errors
63 public function delete(string $key): void;