]> git.mxchange.org Git - friendica.git/blob - src/Core/Config/IPConfiguration.php
Remove unused killme()
[friendica.git] / src / Core / Config / IPConfiguration.php
1 <?php
2
3 namespace Friendica\Core\Config;
4
5 /**
6  * Interface for accessing user specific configurations
7  */
8 interface IPConfiguration
9 {
10
11         /**
12          * Loads all configuration values of a user's config family into a cached storage.
13          *
14          * All configuration values of the given user are stored with the $uid in the cache
15          *
16          * @param int $uid The user_id
17          * @param string $cat The category of the configuration value
18          *
19          * @return void
20          * @see PConfigCache
21          *
22          */
23         function load(int $uid, string $cat = 'config');
24
25         /**
26          * Get a particular user's config variable given the category name
27          * ($cat) and a key.
28          *
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).
32          *
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)
38          *
39          * @return mixed Stored value or null if it does not exist
40          */
41         function get(int $uid, string $cat, string $key, $default_value = null, bool $refresh = false);
42
43         /**
44          * Sets a configuration value for a user
45          *
46          * Stores a config value ($value) in the category ($family) under the key ($key)
47          * for the user_id $uid.
48          *
49          * @note  Please do not store booleans - convert to 0/1 integer values!
50          *
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
55          *
56          * @return bool Operation success
57          */
58         function set(int $uid, string $cat, string $key, $value);
59
60         /**
61          * Deletes the given key from the users's configuration.
62          *
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.
66          *
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
70          *
71          * @return bool
72          */
73         function delete(int $uid, string $cat, string $key);
74
75
76         /**
77          * Returns the Config Cache
78          *
79          * @return Cache\PConfigCache
80          */
81         function getCache();
82 }