PHP Class MatthiasMullie\Scrapbook\Adapters\Couchbase

See also: http://docs.couchbase.com/developer/php-2.0/php-intro.html
Author: Matthias Mullie ([email protected])
Inheritance: implements MatthiasMullie\Scrapbook\KeyValueStore
Mostrar archivo Open project: matthiasmullie/scrapbook

Protected Properties

Property Type Description
$client CouchbaseBucket

Public Methods

Method Description
__construct ( CouchbaseBucket $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 We could use $this->client->counter(), but it doesn't seem to respect data types and stores the values as strings instead of integers.
serialize ( mixed $value ) : string | mixed Couchbase doesn't properly remember the data type being stored: arrays and objects are turned into stdClass instances.
unserialize ( mixed $value ) : mixed | integer | float Restore serialized data.

Method Details

__construct() public method

public __construct ( CouchbaseBucket $client )
$client CouchbaseBucket

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 split up (increment won't accept negative values).
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

increment() public method

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

replace() public method

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

serialize() protected method

Couchbase doesn't properly remember the data type being stored: arrays and objects are turned into stdClass instances.
protected serialize ( mixed $value ) : string | mixed
$value mixed
return string | mixed

set() public method

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

setMulti() public method

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

touch() public method

public touch ( $key, $expire )

unserialize() protected method

Restore serialized data.
protected unserialize ( mixed $value ) : mixed | integer | float
$value mixed
return mixed | integer | float

Property Details

$client protected_oe property

protected CouchbaseBucket $client
return CouchbaseBucket