abstract class AbstractFrontend implements FrontendInterface (View source)

An abstract cache

Properties

protected string $identifier

Identifies this cache

protected BackendInterface $backend

Methods

__construct(string $identifier, BackendInterface $backend)

Constructs the cache

void
initializeObject()

Initializes this frontend

string
getIdentifier()

Returns this cache's identifier

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.

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.

Details

__construct(string $identifier, BackendInterface $backend)

Constructs the cache

Parameters

string $identifier

A identifier which describes this cache

BackendInterface $backend

Backend to be used for this cache

Exceptions

InvalidArgumentException

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.

Return Value

void

string getIdentifier()

Returns this cache's identifier

Return Value

string

The identifier for this cache

BackendInterface getBackend()

Returns the backend used by this cache

Return Value

BackendInterface

The backend used by this cache

bool has(string $entryIdentifier)

Checks if a cache entry with the specified identifier exists.

Parameters

string $entryIdentifier

An identifier specifying the cache entry

Return Value

bool

true if such an entry exists, false if not

Exceptions

InvalidArgumentException

bool remove(string $entryIdentifier)

Removes the given cache entry from the cache.

Parameters

string $entryIdentifier

An identifier specifying the cache entry

Return Value

bool

true if such an entry exists, false if not

Exceptions

InvalidArgumentException

void flush()

Removes all cache entries of this cache.

Return Value

void

int flushByTag(string $tag)

Removes all cache entries of this cache which are tagged by the specified tag.

Parameters

string $tag

The tag the entries must have

Return Value

int

The number of entries which have been affected by this flush or NULL if the number is unknown

Exceptions

InvalidArgumentException

void collectGarbage()

Does garbage collection

Return Value

void

bool isValidEntryIdentifier(string $identifier)

Checks the validity of an entry identifier. Returns true if it's valid.

Parameters

string $identifier

An identifier to be checked for validity

Return Value

bool

bool isValidTag(string $tag)

Checks the validity of a tag. Returns true if it's valid.

Parameters

string $tag

A tag to be checked for validity

Return Value

bool