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
파일 보기 프로젝트 열기: matthiasmullie/scrapbook

보호된 프로퍼티들

프로퍼티 타입 설명
$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[]