PHP 클래스 MatthiasMullie\Scrapbook\Adapters\MemoryStore

This is mainly useful for testing purposes, where this class can let you test application logic against cache, without having to run a cache server.
저자: Matthias Mullie ([email protected])
상속: implements MatthiasMullie\Scrapbook\KeyValueStore
파일 보기 프로젝트 열기: matthiasmullie/scrapbook

보호된 프로퍼티들

프로퍼티 타입 설명
$items array
$limit integer
$size integer

공개 메소드들

메소드 설명
__construct ( integer | string $limit = null )
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 )

보호된 메소드들

메소드 설명
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 split up (increment won't accept negative values).
evict ( ) Least recently used cache values will be evicted from cache should it fill up too much.
exists ( string $key ) : boolean Checks if a value exists in cache and is not yet expired.
lru ( $key ) This cache uses least recently used algorithm. This is to be called with the key to be marked as just used.
normalizeTime ( integer $time ) : integer Times can be: * relative (in seconds) to current time, within 30 days * absolute unix timestamp * 0, for infinity.
shorthandToBytes ( string | integer $shorthand ) : integer Understands shorthand byte values (as used in e.g. memory_limit ini setting) and converts them into bytes.

메소드 상세

__construct() 공개 메소드

public __construct ( integer | string $limit = null )
$limit integer | string Memory limit in bytes (defaults to 10% of memory_limit)

add() 공개 메소드

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

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

doIncrement() 보호된 메소드

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
리턴 integer | boolean

evict() 보호된 메소드

Least recently used cache values will be evicted from cache should it fill up too much.
protected evict ( )

exists() 보호된 메소드

Checks if a value exists in cache and is not yet expired.
protected exists ( string $key ) : boolean
$key string
리턴 boolean

flush() 공개 메소드

public flush ( )

get() 공개 메소드

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

getMulti() 공개 메소드

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

increment() 공개 메소드

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

lru() 보호된 메소드

This cache uses least recently used algorithm. This is to be called with the key to be marked as just used.
protected lru ( $key )

normalizeTime() 보호된 메소드

The first case (relative time) will be normalized into a fixed absolute timestamp.
protected normalizeTime ( integer $time ) : integer
$time integer
리턴 integer

replace() 공개 메소드

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

set() 공개 메소드

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

setMulti() 공개 메소드

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

shorthandToBytes() 보호된 메소드

Understands shorthand byte values (as used in e.g. memory_limit ini setting) and converts them into bytes.
또한 보기: http://php.net/manual/en/faq.using.php#faq.using.shorthandbytes
protected shorthandToBytes ( string | integer $shorthand ) : integer
$shorthand string | integer Amount of bytes (int) or shorthand value (e.g. 512M)
리턴 integer

touch() 공개 메소드

public touch ( $key, $expire )

프로퍼티 상세

$items 보호되어 있는 프로퍼티

protected array $items
리턴 array

$limit 보호되어 있는 프로퍼티

protected int $limit
리턴 integer

$size 보호되어 있는 프로퍼티

protected int $size
리턴 integer