Amp\Cache\PrefixCache class PrefixCache implements Amp\Cache\Cache

Summary

Properties

Methods

Properties

Methods

__construct — public function __construct(Amp\Cache\Cache $cache, $keyPrefix)
No documentation.
Type Parameter Description Default Value
Amp\Cache\Cache $cache No documentation. none
mixed $keyPrefix No documentation. none
getKeyPrefix — public function getKeyPrefix(): string

Gets the current prefix.

get — public function get($key)

Gets a value associated with the given key.

If the specified key doesn't exist implementations MUST succeed the resulting promise with NULL.

Type Parameter Description Default Value
mixed $key string none
set — public function set($key, $value, $ttl = null)

Sets a value associated with the given key. Overrides existing values (if they exist).

Implementations MUST NOT accept NULL as value as it's reserved for missing values and should not have any other meaning. TTL values are measured in seconds.

The default NULL $ttl value indicates no timeout.

The eventual resolution value of the resulting promise is unimportant. The success or failure of the promise indicates the operation's success.

Type Parameter Description Default Value
mixed $key string none
mixed $value string none
mixed $ttl int null
del — public function del($key)

Deletes a value associated with the given key if it exists.

The eventual resolution value of the resulting promise is unimportant. However, implementations SHOULD return boolean TRUE or FALSE to indicate if the specified key existed at the time the delete operation was request.

The ultimate success or failure of the promise indicates the operation's success, though. Implementations MUST transparently succeed operations for non-existent keys.

Type Parameter Description Default Value
mixed $key string none