StringFrontend
class StringFrontend extends AbstractFrontend (View source)
A cache frontend for strings. Nothing else.
Properties
protected string | $identifier | Identifies this cache |
from AbstractFrontend |
protected BackendInterface | $backend | from AbstractFrontend |
Methods
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 which are tagged by the specified tag.
Removes all cache entries of this cache which are tagged by any of the specified tags.
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.
Saves the value of a PHP variable in the cache.
Finds and returns a variable value from the cache.
Finds and returns all cache entries which are tagged by the specified tag.
Details
__construct(string $identifier, BackendInterface $backend)
Constructs the cache
void
initializeObject()
Initializes this frontend
The backend is connected with this frontend in initializeObject(), not in __construct(), because the Cache Factory needs an opportunity to register the cache before the backend's setCache() method is called. See CacheFactory::create() for details. A backend (for example the SimpleFileBackend) may rely on the cache already being registered at the CacheManager when its setCache() method is called.
string
getIdentifier()
Returns this cache's identifier
BackendInterface
getBackend()
Returns the backend used by this cache
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.
void
set(string $entryIdentifier, string $string, array $tags = [], int $lifetime = null)
Saves the value of a PHP variable in the cache.
mixed
get(string $entryIdentifier)
Finds and returns a variable value from the cache.
array
getByTag(string $tag)
Finds and returns all cache entries which are tagged by the specified tag.