trait StaticCacheTrait

Static Cache Trait Adds a static (per request) cache to the object which can hold data for the time of the request (in the frontend) or a certain duration during long running processes. It works together with the global caching system and enforces a static cache clearing in case of global cache clearings as well.

Expected Behavior:

  • Caches during the whole request for local caching
  • Caches are cleared when lib->cache->clear_cache() or clear_request_cache() is called
  • During config->is_install_mode the cache is inactive
  • Endless running daemon processes automatically clears the static cache after some time to enforce an update

Methods

static void
static void
staticCacheClearCachePool($cache_pool = 'default')

Clears the specified cache pool from the static cache

static array|string|int|bool|null
staticCacheGet($key, string $cache_pool = 'default')

Retrieves a value from the static cache

static array
staticCacheGetKeys(string $cache_pool = 'default')

Returns an array of all cache keys which have been set

static array
staticCacheGetPool($cache_pool)

Returns an key/value array with all cached values from the passed pool

static bool
staticCacheIsEnabled()

No description

static bool
staticCacheIsSet($key, string $cache_pool = 'default')

Checks if the passed is key has a value set

static 
staticCacheRemove($key, string $cache_pool = 'default')

Removes the passed key

static void
staticCacheSet(string|int $key, mixed $value, string $cache_pool = 'default')

Store a value in the static cache

Details

at line 121
static void staticCacheClearAllCachePools()

No description

Return Value

void

at line 114
static void staticCacheClearCachePool($cache_pool = 'default')

Clears the specified cache pool from the static cache

Parameters

$cache_pool

Return Value

void

at line 61
static array|string|int|bool|null staticCacheGet($key, string $cache_pool = 'default')

Retrieves a value from the static cache

Parameters

$key
string $cache_pool

Return Value

array|string|int|bool|null

Returns the cached result or null if no value has been stored

at line 98
static array staticCacheGetKeys(string $cache_pool = 'default')

Returns an array of all cache keys which have been set

Parameters

string $cache_pool

Return Value

array

at line 107
static array staticCacheGetPool($cache_pool)

Returns an key/value array with all cached values from the passed pool

Parameters

$cache_pool

Return Value

array

at line 34
static bool staticCacheIsEnabled()

No description

Return Value

bool

at line 85
static bool staticCacheIsSet($key, string $cache_pool = 'default')

Checks if the passed is key has a value set

Parameters

$key
string $cache_pool

Return Value

bool

at line 73
static staticCacheRemove($key, string $cache_pool = 'default')

Removes the passed key

Parameters

$key
string $cache_pool

at line 46
static void staticCacheSet(string|int $key, mixed $value, string $cache_pool = 'default')

Store a value in the static cache

Parameters

string|int $key
mixed $value
string $cache_pool

ID for the cache pool which should be used

Return Value

void