PHP Class MatthiasMullie\Scrapbook\Adapters\Redis

Author: Matthias Mullie ([email protected])
Inheritance: implements MatthiasMullie\Scrapbook\KeyValueStore
Show file Open project: matthiasmullie/scrapbook Class Usage Examples

Protected Properties

Property Type Description
$client Redis
$version string | null

Public Methods

Method Description
__construct ( Redis $client )
add ( $key, $value, $expire )
cas ( $token, $key, $value, $expire )
decrement ( $key, $offset = 1, $initial, $expire )
delete ( $key )
deleteMulti ( array $keys )
flush ( )
get ( $key, &$token = null )
getMulti ( array $keys, array &$tokens = null )
increment ( $key, $offset = 1, $initial, $expire )
replace ( $key, $value, $expire )
set ( $key, $value, $expire )
setMulti ( array $items, $expire )
touch ( $key, $expire )

Protected Methods

Method Description
doIncrement ( string $key, integer $offset, integer $initial, integer $expire ) : integer | boolean Shared between increment/decrement: both have mostly the same logic (decrement just increments a negative value), but need their validation & use of non-ttl native methods split up.
getVersion ( ) : string Returns the version of the Redis server we're connecting to.
supportsOptionsArray ( ) : boolean Version-based check to test if passing an options array to set() is supported.
ttl ( integer $expire ) : integer | null Redis expects true TTL, not expiration timestamp.

Method Details

__construct() public method

public __construct ( Redis $client )
$client Redis

add() public method

public add ( $key, $value, $expire )

cas() public method

public cas ( $token, $key, $value, $expire )

decrement() public method

public decrement ( $key, $offset = 1, $initial, $expire )

delete() public method

public delete ( $key )

deleteMulti() public method

public deleteMulti ( array $keys )
$keys array

doIncrement() protected method

Shared between increment/decrement: both have mostly the same logic (decrement just increments a negative value), but need their validation & use of non-ttl native methods split up.
protected doIncrement ( string $key, integer $offset, integer $initial, integer $expire ) : integer | boolean
$key string
$offset integer
$initial integer
$expire integer
return integer | boolean

flush() public method

public flush ( )

get() public method

public get ( $key, &$token = null )

getMulti() public method

public getMulti ( array $keys, array &$tokens = null )
$keys array
$tokens array

getVersion() protected method

Returns the version of the Redis server we're connecting to.
protected getVersion ( ) : string
return string

increment() public method

public increment ( $key, $offset = 1, $initial, $expire )

replace() public method

public replace ( $key, $value, $expire )

set() public method

public set ( $key, $value, $expire )

setMulti() public method

public setMulti ( array $items, $expire )
$items array

supportsOptionsArray() protected method

Version-based check to test if passing an options array to set() is supported.
protected supportsOptionsArray ( ) : boolean
return boolean

touch() public method

public touch ( $key, $expire )

ttl() protected method

Redis expects true TTL, not expiration timestamp.
protected ttl ( integer $expire ) : integer | null
$expire integer
return integer | null TTL in seconds, or `null` for no expiration

Property Details

$client protected property

protected Redis,MatthiasMullie\Scrapbook\Adapters $client
return Redis

$version protected property

protected string|null $version
return string | null