class db extends config
Configuration container class
Methods
__construct(driver_interface $db, driver_interface $cache, string $table)
Creates a configuration container with a default set of values |
||
ArrayIterator |
getIterator()
Retrieves an ArrayIterator over the configuration values. |
from config |
bool |
offsetExists(string $key)
Checks if the specified config value exists. |
from config |
string |
offsetGet(string $key)
Retrieves a configuration value. |
from config |
offsetSet(string $key, string $value)
Temporarily overwrites the value of a configuration variable. |
from config | |
offsetUnset(string $key)
Called when deleting a configuration value directly, triggers an error. |
from config | |
int |
count()
Retrieves the number of configuration options currently set. |
from config |
null |
delete(String $key, bool $use_cache = true)
Removes a configuration option |
|
set(string $key, string $value, bool $use_cache = true)
Sets a configuration option's value |
||
bool |
set_atomic(string $key, mixed $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. |
|
increment(string $key, int $increment, bool $use_cache = true)
Increments an integer config value directly in the database. |
Details
at line 46
public
__construct(driver_interface $db, driver_interface $cache, string $table)
Creates a configuration container with a default set of values
in config at line 42
public ArrayIterator
getIterator()
Retrieves an ArrayIterator over the configuration values.
in config at line 53
public bool
offsetExists(string $key)
Checks if the specified config value exists.
in config at line 64
public string
offsetGet(string $key)
Retrieves a configuration value.
in config at line 78
public
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 88
public
offsetUnset(string $key)
Called when deleting a configuration value directly, triggers an error.
in config at line 98
public int
count()
Retrieves the number of configuration options currently set.
at line 98
public null
delete(String $key, bool $use_cache = true)
Removes a configuration option
at line 120
public
set(string $key, string $value, bool $use_cache = true)
Sets a configuration option's value
at line 137
public bool
set_atomic(string $key, mixed $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.
at line 184
public
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.