db
class db extends config
Configuration container class
Properties
protected array<string,string> | $config | The configuration data |
from config |
protected driver_interface | $cache | Cache instance |
|
protected driver_interface | $db | Database connection |
|
protected string | $table | Name of the database table used for configuration. |
Methods
Creates a configuration container with a default set of values
Temporarily overwrites the value of a configuration variable.
Called when deleting a configuration value directly, triggers an error.
Removes a configuration option
Sets a configuration option's value
Sets a configuration option's value only if the old_value matches the current configuration value or the configuration value does not exist yet.
Checks configuration option's value only if the new_value matches the current configuration value and the configuration value does exist.Called only after set_atomic has been called.
Increments an integer config value directly in the database.
Details
at line 49
__construct(driver_interface $db, driver_interface $cache, string $table)
Creates a configuration container with a default set of values
in
config at line 42
ArrayIterator
getIterator()
Retrieves an ArrayIterator over the configuration values.
in
config at line 53
bool
offsetExists(string $key)
Checks if the specified config value exists.
in
config at line 65
string
offsetGet(string $key)
Retrieves a configuration value.
in
config at line 80
offsetSet(string $key, string $value)
Temporarily overwrites the value of a configuration variable.
The configuration change will not persist. It will be lost after the request.
in
config at line 91
offsetUnset(string $key)
Called when deleting a configuration value directly, triggers an error.
in
config at line 102
int
count()
Retrieves the number of configuration options currently set.
at line 113
null
delete(string $key, bool $use_cache = true)
Removes a configuration option
at line 135
set(string $key, string $value, bool $use_cache = true)
Sets a configuration option's value
at line 152
bool
set_atomic(string $key, string $old_value, string $new_value, bool $use_cache = true)
Sets a configuration option's value only if the old_value matches the current configuration value or the configuration value does not exist yet.
in
config at line 164
bool
ensure_lock(string $key, string $new_value)
Checks configuration option's value only if the new_value matches the current configuration value and the configuration value does exist.Called only after set_atomic has been called.
at line 199
increment(string $key, int $increment, bool $use_cache = true)
Increments an integer config value directly in the database.
Using this method instead of setting the new value directly avoids race conditions and unlike set_atomic it cannot fail.
at line 65
initialise(driver_interface $cache)
Initialise config with database and/or cached entries