Index Documentation

ICacheProvider extends ICloseable
in

Represents a cache provider.

Table of Contents

Methods

close()  : void
Free, release or reset unmanaged resources.
decrement()  : int
Decrements an item.
delete()  : void
Deletes an item from the cache.
get()  : mixed
Retrieve an item from the cache.
increment()  : int
Increments an item.
set()  : void
Store an item in the cache.
touch()  : void
Sets a new expiration time on an item.

Methods

close()

Free, release or reset unmanaged resources.

public close() : void

decrement()

Decrements an item.

public decrement(string $key[, int $amount = 1 ]) : int
Parameters
$key : string

Key to be decremented.

$amount : int = 1

Amount to decrement by. Defaults to 1.

Tags
throws
RuntimeException

if storing the value in the cache failed.

Return values
int

new, decremented value.

delete()

Deletes an item from the cache.

public delete(string $key) : void
Parameters
$key : string

Key to be deleted.

Tags
throws
RuntimeException

if an error occurred during deletion.

get()

Retrieve an item from the cache.

public get(string $key) : mixed
Parameters
$key : string

Key under which the value is stored.

Return values
mixed

value stored in the cache or null otherwise.

increment()

Increments an item.

public increment(string $key[, int $amount = 1 ]) : int
Parameters
$key : string

Key to be incremented.

$amount : int = 1

Amount to increment by. Defaults to 1.

Tags
throws
RuntimeException

if storing the value in the cache failed.

Return values
int

new, incremented value.

set()

Store an item in the cache.

public set(string $key, mixed $value[, int $ttl = 0 ]) : void
Parameters
$key : string

Key under which to store the value.

$value : mixed

Value to store.

$ttl : int = 0

Amount of seconds to store the value for, 0 for indefinite.

Tags
throws
RuntimeException

if storing the value in the cache failed.

throws
InvalidArgumentException

if an argument is incorrectly formatted, e.g. $ttl set to a negative value.

touch()

Sets a new expiration time on an item.

public touch(string $key[, int $ttl = 0 ]) : void
Parameters
$key : string

Key to be touched.

$ttl : int = 0

Amount of seconds to store the value for, 0 for indefinite.

Tags
throws
RuntimeException

if storing the value in the cache failed.

throws
InvalidArgumentException

if an argument is incorrectly formatted, e.g. $ttl set to a negative value.


        
On this page

Search results