3 namespace Friendica\Core\Config;
7 * @author Hypolite Petovan <mrpetovan@gmail.com>
9 interface IConfigAdapter
12 * @brief Loads all configuration values into a cached storage.
14 * All configuration values of the system are stored in global cache
15 * which is available under the global variable $a->config
17 * @param string $cat The category of the configuration values to load
21 public function load($cat = "config");
24 * @brief Get a particular user's config variable given the category name
25 * ($family) and a key.
27 * Get a particular config value from the given category ($family)
28 * and the $key from a cached storage in $a->config[$uid].
29 * $instore is only used by the set_config function
30 * to determine if the key already exists in the DB
31 * If a key is found in the DB but doesn't exist in
32 * local config cache, pull it into the cache so we don't have
33 * to hit the DB again for this item.
35 * @param string $cat The category of the configuration value
36 * @param string $k The configuration key to query
37 * @param mixed $default_value optional, The value to return if key is not set (default: null)
38 * @param boolean $refresh optional, If true the config is loaded from the db and not from the cache (default: false)
40 * @return mixed Stored value or null if it does not exist
42 public function get($cat, $k, $default_value = null, $refresh = false);
45 * @brief Sets a configuration value for system config
47 * Stores a config value ($value) in the category ($family) under the key ($key)
48 * for the user_id $uid.
50 * Note: Please do not store booleans - convert to 0/1 integer values!
52 * @param string $family The category of the configuration value
53 * @param string $key The configuration key to set
54 * @param mixed $value The value to store
56 * @return mixed Stored $value or false if the database update failed
58 public function set($cat, $k, $value);
61 * @brief Deletes the given key from the system configuration.
63 * Removes the configured value from the stored cache in $a->config
64 * and removes it from the database.
66 * @param string $cat The category of the configuration value
67 * @param string $k The configuration key to delete
71 public function delete($cat, $k);