CollectionCacheTrait
trait CollectionCacheTrait mixin Model
Trait CollectionCacheTrait can be applied to Model
Traits
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.
Methods
Returns all items of the model. Caches the collection at first call
Wraps the find_all_by_id() method, to use the search_all_by_id() method on the cached model collection
Wraps the find_by_id() method, to use the search_by_id() method on the cached model collection
When trait is used in module, we need to apply a namespace
Clears the specified cache pool from the static cache
Retrieves a value from the static cache
Returns an array of all cache keys which have been set
Returns an key/value array with all cached values from the passed pool
Checks if the passed is key has a value set
Removes the passed key
Store a value in the static cache
Details
at line 55
ModelCollection|$this[]
all(array $queryParams = [])
Returns all items of the model. Caches the collection at first call
at line 95
ModelCollection|$this[]
find_all_by_id(array $ids, array $queryParams = [])
Wraps the find_all_by_id() method, to use the search_all_by_id() method on the cached model collection
at line 83
Model|$this
find_by_id(int $id, array $queryParams = [])
Wraps the find_by_id() method, to use the search_by_id() method on the cached model collection
at line 28
init($auto_load = true)
When trait is used in module, we need to apply a namespace
in
StaticCacheTrait at line 121
static void
staticCacheClearAllCachePools()
No description
in
StaticCacheTrait at line 114
static void
staticCacheClearCachePool($cache_pool = 'default')
Clears the specified cache pool from the static cache
in
StaticCacheTrait at line 61
static array|string|int|bool|null
staticCacheGet($key, string $cache_pool = 'default')
Retrieves a value from the static cache
in
StaticCacheTrait at line 98
static array
staticCacheGetKeys(string $cache_pool = 'default')
Returns an array of all cache keys which have been set
in
StaticCacheTrait at line 107
static array
staticCacheGetPool($cache_pool)
Returns an key/value array with all cached values from the passed pool
in
StaticCacheTrait at line 34
static bool
staticCacheIsEnabled()
No description
in
StaticCacheTrait at line 85
static bool
staticCacheIsSet($key, string $cache_pool = 'default')
Checks if the passed is key has a value set
in
StaticCacheTrait at line 73
static
staticCacheRemove($key, string $cache_pool = 'default')
Removes the passed key
in
StaticCacheTrait at line 46
static void
staticCacheSet(string|int $key, mixed $value, string $cache_pool = 'default')
Store a value in the static cache