FrontendInterface
interface FrontendInterface (View source)
Contract for a Cache (frontend)
Constants
PATTERN_ENTRYIDENTIFIER |
Pattern an entry identifier must match. |
PATTERN_TAG |
Pattern a tag must match. |
Methods
Returns this cache's identifier
Returns the backend used by this cache
Saves data in the cache.
Finds and returns data from the cache.
Finds and returns all cache entries which are tagged by the specified tag.
Checks if a cache entry with the specified identifier exists.
Removes the given cache entry from the cache.
Removes all cache entries of this cache.
Removes all cache entries of this cache which are tagged by the specified tag.
Removes all cache entries of this cache which are tagged by any of the specified tags.
Does garbage collection
Checks the validity of an entry identifier. Returns true if it's valid.
Checks the validity of a tag. Returns true if it's valid.
Details
string
getIdentifier()
Returns this cache's identifier
BackendInterface
getBackend()
Returns the backend used by this cache
void
set(string $entryIdentifier, mixed $data, array $tags = [], int $lifetime = null)
Saves data in the cache.
mixed
get(string $entryIdentifier)
Finds and returns data from the cache.
array
getByTag(string $tag)
Finds and returns all cache entries which are tagged by the specified tag.
bool
has(string $entryIdentifier)
Checks if a cache entry with the specified identifier exists.
bool
remove(string $entryIdentifier)
Removes the given cache entry from the cache.
void
flush()
Removes all cache entries of this cache.
int
flushByTag(string $tag)
Removes all cache entries of this cache which are tagged by the specified tag.
int
flushByTags(array $tags)
Removes all cache entries of this cache which are tagged by any of the specified tags.
void
collectGarbage()
Does garbage collection
bool
isValidEntryIdentifier(string $identifier)
Checks the validity of an entry identifier. Returns true if it's valid.
bool
isValidTag(string $tag)
Checks the validity of a tag. Returns true if it's valid.