class SimpleCache implements CacheInterface (View source)

A simple cache frontend Note: This does not follow the \Neos\Cache\Frontend\FrontendInterface this package provides.

Constants

PATTERN_ENTRYIDENTIFIER

Pattern an entry identifier must match.

Properties

protected string $identifier
protected BackendInterface $backend

Methods

__construct(string $identifier, BackendInterface $backend)

Constructs the cache

bool
set(string $key, mixed $variable, int $lifetime = null)

Saves the value of a PHP variable in the cache. Note that the variable will be serialized if necessary.

mixed
get(string $key, mixed $defaultValue = null)

Finds and returns a variable value from the cache.

bool
delete(string $key)

No description

bool
clear()

No description

iterable
getMultiple(iterable $keys, mixed $default = null)

No description

bool
setMultiple(iterable $values, int $ttl = null)

No description

bool
deleteMultiple(iterable $keys)

No description

bool
has(string $key)

No description

bool
isValidEntryIdentifier(string $key)

No description

void
ensureValidEntryIdentifier(string $key)

No description

Details

__construct(string $identifier, BackendInterface $backend)

Constructs the cache

Parameters

string $identifier

A identifier which describes this cache

BackendInterface $backend

Backend to be used for this cache

Exceptions

InvalidArgumentException

bool set(string $key, mixed $variable, int $lifetime = null)

Saves the value of a PHP variable in the cache. Note that the variable will be serialized if necessary.

Parameters

string $key

An identifier used for this cache entry

mixed $variable

The variable to cache

int $lifetime

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

Return Value

bool

Exceptions

Exception
InvalidArgumentException

mixed get(string $key, mixed $defaultValue = null)

Finds and returns a variable value from the cache.

Parameters

string $key

Identifier of the cache entry to fetch

mixed $defaultValue

Return Value

mixed

The value or the defaultValue if entry was not found

Exceptions

Exception
InvalidArgumentException

bool delete(string $key)

No description

Parameters

string $key

Return Value

bool

Exceptions

Exception
InvalidArgumentException

bool clear()

No description

Return Value

bool

iterable getMultiple(iterable $keys, mixed $default = null)

No description

Parameters

iterable $keys
mixed $default

Return Value

iterable

Exceptions

InvalidArgumentException
Exception

bool setMultiple(iterable $values, int $ttl = null)

No description

Parameters

iterable $values
int $ttl

Return Value

bool

Exceptions

Exception
InvalidArgumentException

bool deleteMultiple(iterable $keys)

No description

Parameters

iterable $keys

Return Value

bool

Exceptions

InvalidArgumentException
Exception

bool has(string $key)

No description

Parameters

string $key

Return Value

bool

Exceptions

InvalidArgumentException

protected bool isValidEntryIdentifier(string $key)

No description

Parameters

string $key

Return Value

bool

protected void ensureValidEntryIdentifier(string $key)

No description

Parameters

string $key

Return Value

void

Exceptions

InvalidArgumentException