Scrapbook

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
author

Matthias Mullie [email protected]

copyright

Copyright (c) 2014, Matthias Mullie. All rights reserved

license

LICENSE MIT

Table of Contents

Methods

__construct()  : mixed
add()  : mixed
Add a to-be-resolved cache key.
exists()  : bool
get()  : mixed|null
remove()  : mixed
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

add()

Add a to-be-resolved cache key.

public add(string $unique, string $key) : mixed
Parameters
$unique : string
$key : string

exists()

public exists(string $unique) : bool
Parameters
$unique : string
Return values
bool

get()

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) : mixed

In that case, this method can be called to remove those values.

Parameters
$unique : string

        
On this page

Search results