FrontendInterface

Contract for a Cache (frontend)

Table of Contents

Constants

PATTERN_ENTRYIDENTIFIER  = '/^[a-zA-Z0-9_%\-&]{1,250}$/'
Pattern an entry identifier must match.
PATTERN_TAG  = '/^[a-zA-Z0-9_%\-&]{1,250}$/'
Pattern a tag must match.
TAG_CLASS  = '%CLASS%'
"Magic" tag for class-related entries
TAG_PACKAGE  = '%PACKAGE%'
"Magic" tag for package-related entries

Methods

collectGarbage()  : mixed
Does garbage collection
flush()  : mixed
Removes all cache entries of this cache.
flushByTag()  : mixed
Removes all cache entries of this cache which are tagged by the specified tag.
flushByTags()  : mixed
Removes all cache entries of this cache which are tagged by any of the specified tags.
get()  : mixed
Finds and returns data from the cache.
getBackend()  : BackendInterface
Returns the backend used by this cache
getIdentifier()  : string
Returns this cache's identifier
has()  : bool
Checks if a cache entry with the specified identifier exists.
isValidEntryIdentifier()  : bool
Checks the validity of an entry identifier. Returns TRUE if it's valid.
isValidTag()  : bool
Checks the validity of a tag. Returns TRUE if it's valid.
remove()  : bool
Removes the given cache entry from the cache.
set()  : mixed
Saves data in the cache.

Constants

PATTERN_ENTRYIDENTIFIER

Pattern an entry identifier must match.

public mixed PATTERN_ENTRYIDENTIFIER = '/^[a-zA-Z0-9_%\-&]{1,250}$/'

PATTERN_TAG

Pattern a tag must match.

public mixed PATTERN_TAG = '/^[a-zA-Z0-9_%\-&]{1,250}$/'

TAG_CLASS

"Magic" tag for class-related entries

public mixed TAG_CLASS = '%CLASS%'

TAG_PACKAGE

"Magic" tag for package-related entries

public mixed TAG_PACKAGE = '%PACKAGE%'

Methods

collectGarbage()

Does garbage collection

public collectGarbage() : mixed

flush()

Removes all cache entries of this cache.

public flush() : mixed

flushByTag()

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

public flushByTag(string $tag) : mixed
Parameters
$tag : string

The tag the entries must have

flushByTags()

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

public flushByTags(array<string|int, string> $tags) : mixed
Parameters
$tags : array<string|int, string>

List of tags

get()

Finds and returns data from the cache.

public get(string $entryIdentifier) : mixed
Parameters
$entryIdentifier : string

Something which identifies the cache entry - depends on concrete cache

getIdentifier()

Returns this cache's identifier

public getIdentifier() : string
Return values
string

The identifier for this cache

has()

Checks if a cache entry with the specified identifier exists.

public has(string $entryIdentifier) : bool
Parameters
$entryIdentifier : string

An identifier specifying the cache entry

Return values
bool

TRUE if such an entry exists, FALSE if not

isValidEntryIdentifier()

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

public isValidEntryIdentifier(string $identifier) : bool
Parameters
$identifier : string

An identifier to be checked for validity

Return values
bool

isValidTag()

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

public isValidTag(string $tag) : bool
Parameters
$tag : string

A tag to be checked for validity

Return values
bool

remove()

Removes the given cache entry from the cache.

public remove(string $entryIdentifier) : bool
Parameters
$entryIdentifier : string

An identifier specifying the cache entry

Return values
bool

TRUE if such an entry exists, FALSE if not

set()

Saves data in the cache.

public set(string $entryIdentifier, mixed $data[, array<string|int, mixed> $tags = [] ][, int $lifetime = null ]) : mixed
Parameters
$entryIdentifier : string

Something which identifies the data - depends on concrete cache

$data : mixed

The data to cache - also depends on the concrete cache implementation

$tags : array<string|int, mixed> = []

Tags to associate with this cache entry

$lifetime : int = null

Lifetime of this cache entry in seconds. If NULL is specified, the default lifetime is used. "0" means unlimited lifetime.


        
On this page

Search results