CacheStore
Class.
The cache of a theme or plugin. Inject it to cache data of your own, for example the response of an external API:
Blocks and REST routes with #[Cache] use the same cache. Entries are stored
in the first available backend of the filter
wp_app_framework/cache/backends/{slug} (default: object cache, files,
transients).
Methods
getBackendName()
The backend that stores the entries in this request ("object", "file" or "transient"); null if caching is off.
Returns ?string
invalidate()
Invalidates the tags: entries with one of them are never read again.
Throws InvalidArgumentException: If a tag is invalid, e.g. names an unknown post class.
remember()
Returns the cached value of the key, or computes, stores and returns it.
Values must be plain data: null, booleans, numbers, strings and arrays of them. Exceptions of $compute are passed on; nothing is stored then.
Returns T
Throws InvalidArgumentException: If the key is empty or the ttl, a tag or a variant is invalid.
Throws LogicException: If the value is not plain data.