Cache
class Cache
Implements the cache for a application.
Constants
Priority |
dependency |
Expire |
dependency |
Sliding |
dependency |
Tags |
dependency |
Files |
dependency |
Items |
dependency |
Constants |
dependency |
Callbacks |
dependency |
Namespaces |
dependency |
All |
dependency |
PRIORITY |
|
EXPIRATION |
|
EXPIRE |
|
SLIDING |
|
TAGS |
|
FILES |
|
ITEMS |
|
CONSTS |
|
CALLBACKS |
|
NAMESPACES |
|
ALL |
|
internal NamespaceSeparator |
|
Methods
Returns cache storage.
Returns cache namespace.
Reads the specified item from the cache or generate it.
Reads multiple items from the cache.
Writes item into the cache.
Writes multiple items into cache
Removes item from the cache.
Removes items from the cache by conditions.
Caches results of function/method calls.
Caches results of function/method calls.
Starts the output cache.
No description
Generates internal cache key.
Checks CALLBACKS dependencies.
Details
at line 74
__construct(Storage $storage, string|null $namespace = null)
No description
at line 84
final Storage
getStorage()
Returns cache storage.
at line 93
final string
getNamespace()
Returns cache namespace.
at line 102
Cache
derive(string $namespace)
Returns new nested cache object.
at line 111
mixed
load(mixed $key, callable|null $generator = null, array|null $dependencies = null)
Reads the specified item from the cache or generate it.
at line 134
array
bulkLoad(array $keys, callable|null $generator = null)
Reads multiple items from the cache.
at line 190
mixed
save(mixed $key, mixed $data, array|null $dependencies = null)
Writes item into the cache.
Dependencies are:
- Cache::Priority => (int) priority
- Cache::Expire => (timestamp) expiration, infinite if null
- Cache::Sliding => (bool) use sliding expiration?
- Cache::Tags => (array) tags
- Cache::Files => (array|string) file names
- Cache::Items => (array|string) cache items
- Cache::Constants => (array|string) cache items
at line 223
void
bulkSave(array $items, array|null $dependencies = null)
Writes multiple items into cache
at line 310
void
remove(mixed $key)
Removes item from the cache.
at line 323
void
clean(array|null $conditions = null)
Removes items from the cache by conditions.
Conditions are:
- Cache::Priority => (int) priority
- Cache::Tags => (array) tags
- Cache::All => true
at line 337
mixed
call(callable $function)
Caches results of function/method calls.
at line 351
Closure
wrap(callable $function, array|null $dependencies = null)
Caches results of function/method calls.
at line 370
OutputHelper|null
capture(mixed $key)
Starts the output cache.
at line 382
OutputHelper|null
start($key)
No description
at line 393
protected string
generateKey($key)
Generates internal cache key.
at line 405
static bool
checkCallbacks(array $callbacks)
Checks CALLBACKS dependencies.