AbstractBackend implements BackendInterface, LoggerAwareInterface uses LoggerAwareTrait
An abstract caching backend
Table of Contents
Interfaces
- BackendInterface
- A contract for a Cache Backend
- LoggerAwareInterface
Constants
- DATETIME_EXPIRYTIME_UNLIMITED = '9999-12-31T23:59:59+0000'
- UNLIMITED_LIFETIME = 0
Properties
- $cache : FrontendInterface
- Reference to the cache which uses this backend
- $cacheIdentifier : string
- $context : string
- The current application context
- $defaultLifetime : int
- Default lifetime of a cache entry in seconds
Methods
- __construct() : mixed
- Constructs this backend
- flushByTags() : mixed
- Backwards compatibility safeguard since re-introducing flushByTags as API.
- setCache() : mixed
- Sets a reference to the cache frontend which uses this backend
- setDefaultLifetime() : mixed
- Sets the default lifetime for this cache backend
- calculateExpiryTime() : DateTime
- Calculates the expiry time by the given lifetime. If no lifetime is specified, the default lifetime is used.
Constants
DATETIME_EXPIRYTIME_UNLIMITED
public
mixed
DATETIME_EXPIRYTIME_UNLIMITED
= '9999-12-31T23:59:59+0000'
UNLIMITED_LIFETIME
public
mixed
UNLIMITED_LIFETIME
= 0
Properties
$cache
Reference to the cache which uses this backend
protected
FrontendInterface
$cache
$cacheIdentifier
protected
string
$cacheIdentifier
$context
The current application context
protected
string
$context
This variable is currently unused and set to "production" always. It is only kept to keep backwards compatibility.
$defaultLifetime
Default lifetime of a cache entry in seconds
protected
int
$defaultLifetime
= 3600
Methods
__construct()
Constructs this backend
public
__construct(string $context[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $context : string
-
Unused, for backward compatibility only
- $options : array<string|int, mixed> = []
-
Configuration options - depends on the actual backend
Tags
flushByTags()
Backwards compatibility safeguard since re-introducing flushByTags as API.
public
flushByTags(array<string|int, string> $tags) : mixed
See https://review.typo3.org/#/c/50537/ comments for patch set 14.
The method is here even though it is only required for TaggableBackendInterface. We add it here to ensure third party cache backends do not fail but instead delegate to a less efficient linear flushing behavior.
Parameters
- $tags : array<string|int, string>
setCache()
Sets a reference to the cache frontend which uses this backend
public
setCache(FrontendInterface $cache) : mixed
Parameters
- $cache : FrontendInterface
-
The frontend for this backend
setDefaultLifetime()
Sets the default lifetime for this cache backend
public
setDefaultLifetime(int $defaultLifetime) : mixed
Parameters
- $defaultLifetime : int
-
Default lifetime of this cache backend in seconds. If NULL is specified, the default lifetime is used. "0" means unlimited lifetime.
Tags
calculateExpiryTime()
Calculates the expiry time by the given lifetime. If no lifetime is specified, the default lifetime is used.
protected
calculateExpiryTime([int $lifetime = null ]) : DateTime
Parameters
- $lifetime : int = null
-
The lifetime in seconds
Return values
DateTime —The expiry time