Repository
in package
Helper object to serve as glue between pool & item.
New items are created by first get()-ing them from the pool. It would be inefficient to let such a get() immediately query the real cache (because it may not be meant to retrieve real data, but just to set a new value)
Instead, every Item returned by get() will be a "placeholder", and once the values are actually needed, this object will be called to go do that (along with every other value that has not yet been resolved, while we're at it)
Tags
Table of Contents
Methods
- __construct() : mixed
- add() : void
- Add a to-be-resolved cache key.
- exists() : bool
- get() : mixed|null
- remove() : void
- This repository holds the real values for all Item objects. However, if such an item gets garbage collected, there is no point in wasting any more memory storing that value.
Methods
__construct()
public
__construct(KeyValueStore $store) : mixed
Parameters
- $store : KeyValueStore
add()
Add a to-be-resolved cache key.
public
add(string $unique, string $key) : void
Parameters
- $unique : string
- $key : string
exists()
public
exists(string $unique) : bool
Parameters
- $unique : string
Return values
boolget()
public
get(string $unique) : mixed|null
Parameters
- $unique : string
Return values
mixed|null —Value, of null if non-existent
remove()
This repository holds the real values for all Item objects. However, if such an item gets garbage collected, there is no point in wasting any more memory storing that value.
public
remove(string $unique) : void
In that case, this method can be called to remove those values.
Parameters
- $unique : string