Typo3DatabaseBackend extends AbstractBackend implements TaggableBackendInterface

A caching backend which stores cache entries in database tables

Table of Contents

Interfaces

TaggableBackendInterface
A contract for a cache backend which supports tagging.

Constants

FAKED_UNLIMITED_EXPIRE  : int = 2145909600

Properties

$cacheIdentifier  : string
$cacheTable  : string
$compression  : bool
$compressionLevel  : int
$defaultLifetime  : int
Default lifetime of a cache entry in seconds
$maximumLifetime  : int
$tagsTable  : string

Methods

__construct()  : mixed
collectGarbage()  : void
Does garbage collection
findIdentifiersByTag()  : array<string|int, mixed>
Finds and returns all cache entry identifiers which are tagged by the specified tag
flush()  : void
Removes all cache entries of this cache.
flushByTag()  : void
Removes all cache entries of this cache which are tagged by the specified tag.
flushByTags()  : void
Removes all cache entries of this cache which are tagged by any of the specified tags.
get()  : mixed
Loads data from the cache.
getTableDefinitions()  : string
Calculate needed table definitions for this cache.
has()  : bool
Checks if a cache entry with the specified identifier exists.
remove()  : bool
Removes all cache entries matching the specified identifier.
set()  : void
Saves data in the cache.
setCache()  : void
Sets a reference to the cache frontend which uses this backend
deleteTagsChunked()  : void
setCompression()  : void
setCompressionLevel()  : void
Set data compression level.
setDefaultLifetime()  : void
Sets the default lifetime for this cache backend

Constants

FAKED_UNLIMITED_EXPIRE

protected int FAKED_UNLIMITED_EXPIRE = 2145909600

Timestamp of 2038-01-01

Properties

$cacheIdentifier

protected string $cacheIdentifier

$cacheTable

protected string $cacheTable

Name of the cache data table

$compression

protected bool $compression = false

Indicates whether data is compressed or not (requires php zlib)

$compressionLevel

protected int $compressionLevel = -1

-1 to 9, indicates zlib compression level: -1 = default level 6, 0 = no compression, 9 maximum compression

$defaultLifetime

Default lifetime of a cache entry in seconds

protected int $defaultLifetime = 3600

$maximumLifetime

protected int $maximumLifetime

Maximum lifetime to stay with expire field below FAKED_UNLIMITED_LIFETIME

$tagsTable

protected string $tagsTable

Name of the cache tags table

Methods

__construct()

public __construct([array<string|int, mixed> $options = [] ]) : mixed
Parameters
$options : array<string|int, mixed> = []

Configuration options - depends on the actual backend

collectGarbage()

Does garbage collection

public collectGarbage() : void

findIdentifiersByTag()

Finds and returns all cache entry identifiers which are tagged by the specified tag

public findIdentifiersByTag(string $tag) : array<string|int, mixed>
Parameters
$tag : string

The tag to search for

Return values
array<string|int, mixed> —

An array with identifiers of all matching entries. An empty array if no entries matched

flush()

Removes all cache entries of this cache.

public flush() : void

flushByTag()

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

public flushByTag(string $tag) : void
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, mixed> $tags) : void
Parameters
$tags : array<string|int, mixed>

List of tags

get()

Loads data from the cache.

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

An identifier which describes the cache entry to load

Return values
mixed —

The cache entry's content as a string or FALSE if the cache entry could not be loaded

getTableDefinitions()

Calculate needed table definitions for this cache.

public getTableDefinitions() : string

This helper method is used by install tool and extension manager and is not part of the public API!

Return values
string —

SQL of table definitions

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

remove()

Removes all cache entries matching the specified identifier.

public remove(string $entryIdentifier) : bool

Usually this only affects one entry but if - for what reason ever - old entries for the identifier still exist, they are removed as well.

Parameters
$entryIdentifier : string

Specifies the cache entry to remove

Return values
bool —

TRUE if (at least) an entry could be removed or FALSE if no entry was found

set()

Saves data in the cache.

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

An identifier for this specific cache entry

$data : string

The data to be stored

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

Tags to associate with this cache entry. If the backend does not support tags, this option can be ignored.

$lifetime : mixed = null

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

deleteTagsChunked()

protected deleteTagsChunked(array<string|int, string> $items) : void
Parameters
$items : array<string|int, string>

setCompression()

protected setCompression(bool $compression) : void
Parameters
$compression : bool

setCompressionLevel()

Set data compression level.

protected setCompressionLevel(int $compressionLevel) : void

If compression is enabled and this is not set, gzcompress default level will be used

Parameters
$compressionLevel : int

-1 to 9: Compression level

setDefaultLifetime()

Sets the default lifetime for this cache backend

protected setDefaultLifetime(int $defaultLifetime) : void
Parameters
$defaultLifetime : int

Default lifetime in seconds, "0" means unlimited lifetime

On this page

Search results