PHP Класс MatthiasMullie\Scrapbook\Scale\Shard

Pass the individual KeyValueStore objects that compose the cache server pool into this constructor how you want the data to be sharded. The cache data will be sharded over them according to the order they were in when they were passed into this constructor (so make sure to always keep the order the same) The sharding is spread evenly and all cache servers will roughly receive the same amount of cache keys. If some servers are bigger than others, you can offset this by adding the KeyValueStore object more than once. Data can even be sharded among different adapters: one server in the shard pool can be Redis while another can be Memcached. Not sure why you would even want that, but you could!
Автор: Matthias Mullie ([email protected])
Наследование: implements MatthiasMullie\Scrapbook\KeyValueStore
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$caches MatthiasMullie\Scrapbook\KeyValueStore[]

Открытые методы

Метод Описание
__construct ( MatthiasMullie\Scrapbook\KeyValueStore $cache1, MatthiasMullie\Scrapbook\KeyValueStore $cache2 = null ) Overloadable with multiple KeyValueStore objects.
add ( $key, $value, $expire )
addCache ( MatthiasMullie\Scrapbook\KeyValueStore $cache )
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 )

Защищенные методы

Метод Описание
getShard ( string $key ) : MatthiasMullie\Scrapbook\KeyValueStore Get the shard (KeyValueStore object) that corresponds to a particular cache key.
getShards ( array $keys ) : SplObjectStorage Get a [KeyValueStore => array of cache keys] map (SplObjectStorage) for multiple cache keys.

Описание методов

__construct() публичный Метод

Overloadable with multiple KeyValueStore objects.
public __construct ( MatthiasMullie\Scrapbook\KeyValueStore $cache1, MatthiasMullie\Scrapbook\KeyValueStore $cache2 = null )
$cache1 MatthiasMullie\Scrapbook\KeyValueStore
$cache2 MatthiasMullie\Scrapbook\KeyValueStore

add() публичный Метод

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

addCache() публичный Метод

public addCache ( MatthiasMullie\Scrapbook\KeyValueStore $cache )
$cache MatthiasMullie\Scrapbook\KeyValueStore

cas() публичный Метод

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

decrement() публичный Метод

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

delete() публичный Метод

public delete ( $key )

deleteMulti() публичный Метод

public deleteMulti ( array $keys )
$keys array

flush() публичный Метод

public flush ( )

get() публичный Метод

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

getMulti() публичный Метод

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

getShard() защищенный Метод

Get the shard (KeyValueStore object) that corresponds to a particular cache key.
protected getShard ( string $key ) : MatthiasMullie\Scrapbook\KeyValueStore
$key string
Результат MatthiasMullie\Scrapbook\KeyValueStore

getShards() защищенный Метод

Get a [KeyValueStore => array of cache keys] map (SplObjectStorage) for multiple cache keys.
protected getShards ( array $keys ) : SplObjectStorage
$keys array
Результат SplObjectStorage

increment() публичный Метод

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

replace() публичный Метод

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

set() публичный Метод

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

setMulti() публичный Метод

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

touch() публичный Метод

public touch ( $key, $expire )

Описание свойств

$caches защищенное свойство

protected KeyValueStore[],MatthiasMullie\Scrapbook $caches
Результат MatthiasMullie\Scrapbook\KeyValueStore[]