mirror of
https://github.com/friendica/friendica
synced 2025-04-26 13:50:11 +00:00
Migrate distributed cache config value
This commit is contained in:
parent
b4c1fb0d9c
commit
6ca5668ac1
5 changed files with 37 additions and 7 deletions
|
@ -31,14 +31,16 @@ use ParagonIE\HiddenString\HiddenString;
|
|||
*/
|
||||
class Cache
|
||||
{
|
||||
/** @var int Indicates that the cache entry is a default value - Lowest Priority */
|
||||
const SOURCE_STATIC = 0;
|
||||
/** @var int Indicates that the cache entry is set by file - Low Priority */
|
||||
const SOURCE_FILE = 0;
|
||||
const SOURCE_FILE = 1;
|
||||
/** @var int Indicates that the cache entry is set by the DB config table - Middle Priority */
|
||||
const SOURCE_DB = 1;
|
||||
const SOURCE_DB = 2;
|
||||
/** @var int Indicates that the cache entry is set by a server environment variable - High Priority */
|
||||
const SOURCE_ENV = 3;
|
||||
/** @var int Indicates that the cache entry is fixed and must not be changed */
|
||||
const SOURCE_FIX = 4;
|
||||
const SOURCE_FIX = 5;
|
||||
|
||||
/** @var int Default value for a config source */
|
||||
const SOURCE_DEFAULT = self::SOURCE_FILE;
|
||||
|
@ -113,6 +115,19 @@ class Cache
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the source value of the current, cached config value
|
||||
*
|
||||
* @param string $cat Config category
|
||||
* @param string $key Config key
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getSource(string $cat, string $key): int
|
||||
{
|
||||
return $this->source[$cat][$key] ?? -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a value in the config cache. Accepts raw output from the config table
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue