PhpFrontend
class PhpFrontend extends StringFrontend (View source)
A cache frontend tailored to PHP code.
Properties
protected string | $identifier | Identifies this cache |
from AbstractFrontend |
protected PhpCapableBackendInterface | $backend |
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 PHP source code in the cache.
Finds and returns the original code from the cache.
Finds and returns all cache entries which are tagged by the specified tag.
Returns the code wrapped in php tags as written to the cache, ready to be included.
Loads PHP code from the cache and require_onces it right away.
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 $sourceCode, array $tags = [], int $lifetime = null)
Saves the PHP source code in the cache.
mixed
get(string $entryIdentifier)
Finds and returns the original code from the cache.
array
getByTag(string $tag)
Finds and returns all cache entries which are tagged by the specified tag.
string
getWrapped(string $entryIdentifier)
Returns the code wrapped in php tags as written to the cache, ready to be included.
mixed
requireOnce(string $entryIdentifier)
Loads PHP code from the cache and require_onces it right away.