Cache
class Cache
Implements the cache for a application.
Constants
PRIORITY |
dependency |
EXPIRATION |
dependency |
EXPIRE |
dependency |
SLIDING |
dependency |
TAGS |
dependency |
FILES |
dependency |
ITEMS |
dependency |
CONSTS |
dependency |
CALLBACKS |
dependency |
NAMESPACES |
dependency |
ALL |
dependency |
internal NAMESPACE_SEPARATOR |
|
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.
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.
Generates internal cache key.
Checks CALLBACKS dependencies.
Details
at line 46
__construct(Storage $storage, string $namespace = null)
No description
at line 56
final Storage
getStorage()
Returns cache storage.
at line 65
final string
getNamespace()
Returns cache namespace.
at line 75
Cache
derive(string $namespace)
Returns new nested cache object.
at line 86
mixed
load(mixed $key, callable $generator = null)
Reads the specified item from the cache or generate it.
at line 107
array
bulkLoad(array $keys, callable $generator = null)
Reads multiple items from the cache.
at line 167
mixed
save(mixed $key, mixed $data, array $dependencies = null)
Writes item into the cache.
Dependencies are:
- Cache::PRIORITY => (int) priority
- Cache::EXPIRATION => (timestamp) expiration
- Cache::SLIDING => (bool) use sliding expiration?
- Cache::TAGS => (array) tags
- Cache::FILES => (array|string) file names
- Cache::ITEMS => (array|string) cache items
- Cache::CONSTS => (array|string) cache items
at line 244
void
remove(mixed $key)
Removes item from the cache.
at line 257
void
clean(array $conditions = null)
Removes items from the cache by conditions.
Conditions are:
- Cache::PRIORITY => (int) priority
- Cache::TAGS => (array) tags
- Cache::ALL => true
at line 271
mixed
call(callable $function)
Caches results of function/method calls.
at line 286
Closure
wrap(callable $function, array $dependencies = null)
Caches results of function/method calls.
at line 305
OutputHelper|null
capture(mixed $key)
Starts the output cache.
at line 319
OutputHelper|null
start($key)
deprecated
deprecated
No description
at line 328
protected string
generateKey($key)
Generates internal cache key.
at line 340
static bool
checkCallbacks(array $callbacks)
Checks CALLBACKS dependencies.
Traits
Strict class for better experience.