3 namespace Friendica\Core\Config;
6 * Interface for accessing user specific configurations
8 interface IPConfiguration
12 * Loads all configuration values of a user's config family into a cached storage.
14 * All configuration values of the given user are stored with the $uid in the cache
16 * @param int $uid The user_id
17 * @param string $cat The category of the configuration value
23 function load(int $uid, string $cat = 'config');
26 * Get a particular user's config variable given the category name
29 * Get a particular user's config value from the given category ($cat)
30 * and the $key with the $uid from a cached storage either from the $this->configAdapter
31 * (@see IConfigAdapter) or from the $this->configCache (@see PConfigCache).
33 * @param int $uid The user_id
34 * @param string $cat The category of the configuration value
35 * @param string $key The configuration key to query
36 * @param mixed $default_value optional, The value to return if key is not set (default: null)
37 * @param boolean $refresh optional, If true the config is loaded from the db and not from the cache (default: false)
39 * @return mixed Stored value or null if it does not exist
41 function get(int $uid, string $cat, string $key, $default_value = null, bool $refresh = false);
44 * Sets a configuration value for a user
46 * Stores a config value ($value) in the category ($family) under the key ($key)
47 * for the user_id $uid.
49 * @note Please do not store booleans - convert to 0/1 integer values!
51 * @param int $uid The user_id
52 * @param string $cat 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 bool Operation success
58 function set(int $uid, string $cat, string $key, $value);
61 * Deletes the given key from the users's configuration.
63 * Removes the configured value from the stored cache in $this->configCache
64 * (@see ConfigCache) and removes it from the database (@see IConfigAdapter)
65 * with the given $uid.
67 * @param int $uid The user_id
68 * @param string $cat The category of the configuration value
69 * @param string $key The configuration key to delete
73 function delete(int $uid, string $cat, string $key);
77 * Returns the Config Cache
79 * @return Cache\PConfigCache