MultiBackend
class MultiBackend extends AbstractBackend implements BackendInterface (View source)
A multi backend, falling back to multiple backends if errors occur.
Traits
Abstracts the task of creating a BackendInterface implementation with it's options.
Constants
DATETIME_EXPIRYTIME_UNLIMITED |
|
UNLIMITED_LIFETIME |
|
Properties
protected FrontendInterface | $cache | Reference to the cache frontend which uses this backend |
from AbstractBackend |
protected string | $cacheIdentifier | from AbstractBackend | |
protected string | $identifierPrefix | A prefix to seperate stored by appliaction context and cache |
from AbstractBackend |
protected int | $defaultLifetime | Default lifetime of a cache entry in seconds |
from AbstractBackend |
protected EnvironmentConfiguration | $environmentConfiguration | from AbstractBackend | |
protected array | $backendConfigurations | Configuration for all sub backends (each with the keys "backend" and "backendOptions") |
|
protected BackendInterface[] | $backends | ||
protected bool | $setInAllBackends | ||
protected bool | $debug | ||
protected bool | $initialized | Are the backends initialized |
Methods
Constructs this backend
No description
Sets the default lifetime for this cache backend
Calculates the expiry time by the given lifetime. If no lifetime is specified, the default lifetime is used.
Returns the internally used, prefixed entry identifier for the given public entry identifier.
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Details
__construct(EnvironmentConfiguration $environmentConfiguration, array $options)
Constructs this backend
protected void
setProperties(array $properties, bool $throwExceptionIfPropertyNotSettable = true)
No description
protected bool
setProperty(string $propertyName, mixed $propertyValue)
No description
void
setCache(FrontendInterface $cache)
Sets a reference to the cache frontend which uses this backend
void
setDefaultLifetime(int|string $defaultLifetime)
Sets the default lifetime for this cache backend
protected DateTime
calculateExpiryTime(int $lifetime = null)
Calculates the expiry time by the given lifetime. If no lifetime is specified, the default lifetime is used.
string
getPrefixedIdentifier(string $entryIdentifier)
Returns the internally used, prefixed entry identifier for the given public entry identifier.
While Flow applications will mostly refer to the simple entry identifier, it may be necessary to know the actual identifier used by the cache backend in order to share cache entries with other applications. This method allows for retrieving it.
Note that, in case of the AbstractBackend, this method is returns just the given entry identifier.
protected BackendInterface
instantiateBackend(string $backendObjectName, array $backendOptions, EnvironmentConfiguration $environmentConfiguration)
No description
protected void
prepareBackends()
No description
protected BackendInterface|null
buildSubBackend(string $backendClassName, array $backendOptions)
No description
void
set(string $entryIdentifier, string $data, array $tags = [], int $lifetime = null)
No description
mixed
get(string $entryIdentifier)
No description
bool
has(string $entryIdentifier)
No description
bool
remove(string $entryIdentifier)
No description
void
flush()
No description
void
collectGarbage()
No description
protected void
setBackendConfigurations(array $backendConfigurations)
No description
protected void
setSetInAllBackends(bool $setInAllBackends)
No description
protected void
setDebug(bool $debug)
No description
protected void
setInBackend(BackendInterface $backend, string $entryIdentifier, string $data, array $tags = [], int $lifetime = null)
No description
protected mixed
getFromBackend(BackendInterface $backend, string $entryIdentifier)
No description
protected bool
backendHas(BackendInterface $backend, string $entryIdentifier)
No description
protected bool
removeFromBackend(BackendInterface $backend, string $entryIdentifier)
No description
protected void
flushBackend(BackendInterface $backend)
No description
protected void
handleError(Throwable $throwable)
No description