Documentation

MsgPackObjectDriver
in package
implements RdbObjectDriver

Store an object as a MessagePack string.

Objects are expected to implement JsonSerializable and JsonDeserializable. For convenience, implement the RdbJsonObject interface.

The 'expected' parameter is required.

Table of Contents

Interfaces

RdbObjectDriver
Base interface for object drivers.

Properties

$rdb  : Rdb

Methods

__construct()  : mixed
getObject()  : T|null
Get an object from a key.
inspect()  : string|null
Inspect the object stored in the key.
mGetObjects()  : array<string, T|null>
Get multiple objects from a key.
mSetObjects()  : array<string|int, int>
Set multiple objects.
setObject()  : int
Set an object.

Properties

Methods

getObject()

Get an object from a key.

public getObject(string $key, string $expected) : T|null
Parameters
$key : string
$expected : string
Tags
inheritdoc
Return values
T|null

inspect()

Inspect the object stored in the key.

public inspect(string $key) : string|null
Parameters
$key : string
Tags
inheritdoc
Return values
string|null —

the object class name

mGetObjects()

Get multiple objects from a key.

public mGetObjects(array<string|int, mixed> $keys, string $expected) : array<string, T|null>
Parameters
$keys : array<string|int, mixed>
$expected : string
Tags
inheritdoc
Return values
array<string, T|null>

mSetObjects()

Set multiple objects.

public mSetObjects(iterable<string|int, mixed> $items) : array<string|int, int>
Parameters
$items : iterable<string|int, mixed>

[ key => object ]

Tags
inheritdoc
Return values
array<string|int, int> —

[ key => int ] object sizes in bytes

setObject()

Set an object.

public setObject(string $key, object $value[, int|float $ttl = 0 ]) : int
Parameters
$key : string
$value : object
$ttl : int|float = 0

seconds

Tags
inheritdoc
Return values
int —

object size in bytes

On this page

Search results