class NullBackend extends AbstractBackend implements PhpCapableBackendInterface, TaggableBackendInterface (View source)

A caching backend which forgets everything immediately

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

Methods

__construct(EnvironmentConfiguration $environmentConfiguration = null, array $options = [])

Constructs this backend

void
setProperties(array $properties, bool $throwExceptionIfPropertyNotSettable = true)

No description

bool
setProperty(string $propertyName, mixed $propertyValue)

Successfully ignore every configured property

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

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.

void
set(string $entryIdentifier, string $data, array $tags = [], int $lifetime = null)

Acts as if it would save data

mixed
get(string $entryIdentifier)

Returns False

bool
has(string $entryIdentifier)

Returns False

bool
remove(string $entryIdentifier)

Does nothing

array
findIdentifiersByTag(string $tag)

Returns an empty array

void
flush()

Does nothing

int
flushByTag(string $tag)

Does nothing

void
collectGarbage()

Does nothing

mixed
requireOnce(string $identifier)

Does nothing

Details

__construct(EnvironmentConfiguration $environmentConfiguration = null, array $options = [])

Constructs this backend

Parameters

EnvironmentConfiguration $environmentConfiguration
array $options

Configuration options - depends on the actual backend

protected void setProperties(array $properties, bool $throwExceptionIfPropertyNotSettable = true)

No description

Parameters

array $properties
bool $throwExceptionIfPropertyNotSettable

Return Value

void

Exceptions

InvalidArgumentException

protected bool setProperty(string $propertyName, mixed $propertyValue)

Successfully ignore every configured property

Parameters

string $propertyName
mixed $propertyValue

Return Value

bool

void setCache(FrontendInterface $cache)

Sets a reference to the cache frontend which uses this backend

Parameters

FrontendInterface $cache

The frontend for this backend

Return Value

void

void setDefaultLifetime(int|string $defaultLifetime)

Sets the default lifetime for this cache backend

Parameters

int|string $defaultLifetime

Default lifetime of this cache backend in seconds. 0 means unlimited lifetime.

Return Value

void

Exceptions

InvalidArgumentException

protected DateTime calculateExpiryTime(int $lifetime = null)

Calculates the expiry time by the given lifetime. If no lifetime is specified, the default lifetime is used.

Parameters

int $lifetime

The lifetime in seconds

Return Value

DateTime

The expiry time

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.

Parameters

string $entryIdentifier

Return Value

string

void set(string $entryIdentifier, string $data, array $tags = [], int $lifetime = null)

Acts as if it would save data

Parameters

string $entryIdentifier

An identifier for this specific cache entry

string $data

The data to be stored

array $tags

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

int $lifetime

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

Return Value

void

mixed get(string $entryIdentifier)

Returns False

Parameters

string $entryIdentifier

An identifier which describes the cache entry to load

Return Value

mixed

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

bool has(string $entryIdentifier)

Returns False

Parameters

string $entryIdentifier

An identifier specifying the cache entry

Return Value

bool

true if such an entry exists, false if not

bool remove(string $entryIdentifier)

Does nothing

Parameters

string $entryIdentifier

Specifies the cache entry to remove

Return Value

bool

true if (at least) an entry could be removed or false if no entry was found

array findIdentifiersByTag(string $tag)

Returns an empty array

Parameters

string $tag

The tag to search for

Return Value

array

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

void flush()

Does nothing

Return Value

void

int flushByTag(string $tag)

Does nothing

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

void collectGarbage()

Does nothing

Return Value

void

mixed requireOnce(string $identifier)

Does nothing

Parameters

string $identifier

An identifier which describes the cache entry to load

Return Value

mixed

Potential return value from the include operation