Memory
class Memory extends Store implements IncrementDecrementInterface
Memory store.
Properties
protected string|null | $prefix | Prefix. | from Store |
protected array | $cache | Cache data. |
Methods
Store data in the cache if it doesn't already exist.
Fetch data from the cache and replace it. NULL will be returned if the item does not exist.
Fetch data from the cache and remove it. NULL will be returned if the item does not exist.
Fetch data from the cache or store it if it doesn't already exist.
Store data in the cache.
Increments a stored number.
Decrements a stored number.
Returns TRUE if the cache key exists and FALSE if not.
Fetch data from the cache. NULL will be returned if the item does not exist.
Delete data from the cache.
Clears the cache.
Details
in Store at line 28
$this
setPrefix(string $prefix)
Sets the cache key prefix.
in Store at line 40
string|null
getPrefix()
Returns the cache key prefix.
in Store at line 51
protected string
getPrefixedKey(string $key)
Returns a prefixed key.
in Store at line 59
bool
putIfNotExists(string $key, mixed $data, int $ttl = 0)
Store data in the cache if it doesn't already exist.
in Store at line 77
mixed
getAndPut(string $key, mixed $data, int $ttl = 0)
Fetch data from the cache and replace it. NULL will be returned if the item does not exist.
in Store at line 92
mixed
getAndRemove(string $key)
Fetch data from the cache and remove it. NULL will be returned if the item does not exist.
in Store at line 107
mixed
getOrElse(string $key, callable $data, int $ttl = 0)
Fetch data from the cache or store it if it doesn't already exist.
at line 27
bool
put(string $key, mixed $data, int $ttl = 0)
Store data in the cache.
at line 39
false|int
increment(string $key, int $step = 1)
Increments a stored number.
at line 54
false|int
decrement(string $key, int $step = 1)
Decrements a stored number.
at line 69
bool
has(string $key)
Returns TRUE if the cache key exists and FALSE if not.
at line 77
mixed
get(string $key)
Fetch data from the cache. NULL will be returned if the item does not exist.
at line 95
bool
remove(string $key)
Delete data from the cache.
at line 110
bool
clear()
Clears the cache.