PHP 클래스 MatthiasMullie\Scrapbook\Adapters\Apc

저자: Matthias Mullie ([email protected])
상속: implements MatthiasMullie\Scrapbook\KeyValueStore
파일 보기 프로젝트 열기: matthiasmullie/scrapbook

보호된 프로퍼티들

프로퍼티 타입 설명
$expires array APC does this crazy thing of only deleting expired data on every new (page) request, not checking it when you actually retrieve the value (which you may just have set in the same request) Since it's totally possible to store values that expire in the same request, we'll keep track of those expiration times here & filter them out in case they did expire.

공개 메소드들

메소드 설명
__construct ( )
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 )

보호된 메소드들

메소드 설명
APCuIterator ( string | string[] | null $search = null, integer $format = null, integer $chunk_size = null, integer $list = null ) : APCIterato\APCIterator | APCuIterato\APCuIterator
acquire ( string | string[] $keys ) : string[] Acquire a lock - required to provide CAS functionality.
apcu_add ( string | string[] $key, mixed $var, integer $ttl ) : boolean | bool[]
apcu_clear_cache ( ) : boolean
apcu_delete ( string | string[] | APCIterato\APCIterator | APCuIterato\APCuIterator $key ) : boolean | string[]
apcu_fetch ( string | string[] $key, boolean &$success = null ) : mixed | false
apcu_store ( string | string[] $key, mixed $var, integer $ttl ) : boolean | bool[]
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).
expire ( array | string $key = [], integer $ttl ) Store the expiration time for items we're setting in this request, to work around APC's behavior of only clearing expires per page request.
lock ( string | string[] $keys ) : array Acquire a lock. If we failed to acquire a lock, it'll automatically try again in 1ms, for a maximum of 10 times.
ttl ( integer $expire ) : integer APC expects true TTL, not expiration timestamp.
unlock ( string | string[] $keys ) : boolean Release a lock.

메소드 상세

APCuIterator() 보호된 메소드

protected APCuIterator ( string | string[] | null $search = null, integer $format = null, integer $chunk_size = null, integer $list = null ) : APCIterato\APCIterator | APCuIterato\APCuIterator
$search string | string[] | null
$format integer
$chunk_size integer
$list integer
리턴 APCIterato\APCIterator | APCuIterato\APCuIterator

__construct() 공개 메소드

public __construct ( )

acquire() 보호된 메소드

Acquire a lock - required to provide CAS functionality.
protected acquire ( string | string[] $keys ) : string[]
$keys string | string[]
리턴 string[] Array of successfully locked keys

add() 공개 메소드

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

apcu_add() 보호된 메소드

protected apcu_add ( string | string[] $key, mixed $var, integer $ttl ) : boolean | bool[]
$key string | string[]
$var mixed
$ttl integer
리턴 boolean | bool[]

apcu_clear_cache() 보호된 메소드

protected apcu_clear_cache ( ) : boolean
리턴 boolean

apcu_delete() 보호된 메소드

protected apcu_delete ( string | string[] | APCIterato\APCIterator | APCuIterato\APCuIterator $key ) : boolean | string[]
$key string | string[] | APCIterato\APCIterator | APCuIterato\APCuIterator
리턴 boolean | string[]

apcu_fetch() 보호된 메소드

protected apcu_fetch ( string | string[] $key, boolean &$success = null ) : mixed | false
$key string | string[]
$success boolean
리턴 mixed | false

apcu_store() 보호된 메소드

protected apcu_store ( string | string[] $key, mixed $var, integer $ttl ) : boolean | bool[]
$key string | string[]
$var mixed
$ttl integer
리턴 boolean | bool[]

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

expire() 보호된 메소드

Store the expiration time for items we're setting in this request, to work around APC's behavior of only clearing expires per page request.
또한 보기: static::$expires
protected expire ( array | string $key = [], integer $ttl )
$key array | string
$ttl integer

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 )

lock() 보호된 메소드

APC provides nothing that would allow us to do CAS. To "emulate" CAS, we'll work with locks: all cache writes also briefly create a lock cache entry (yup: #writes * 3, for lock & unlock - luckily, they're not over the network) Writes are disallows when a lock can't be obtained (= locked by another write), which makes it possible for us to first retrieve, compare & then set in a nob-atomic way. However, there's a possibility for interference with direct APC access touching the same keys - e.g. other scripts, not using this class. If CAS is of importance, make sure the only things touching APC on your server is using these classes!
protected lock ( string | string[] $keys ) : array
$keys string | string[]
리턴 array Array of successfully locked keys

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 )

ttl() 보호된 메소드

APC expects true TTL, not expiration timestamp.
protected ttl ( integer $expire ) : integer
$expire integer
리턴 integer TTL in seconds

unlock() 보호된 메소드

Release a lock.
protected unlock ( string | string[] $keys ) : boolean
$keys string | string[]
리턴 boolean

프로퍼티 상세

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

APC does this crazy thing of only deleting expired data on every new (page) request, not checking it when you actually retrieve the value (which you may just have set in the same request) Since it's totally possible to store values that expire in the same request, we'll keep track of those expiration times here & filter them out in case they did expire.
또한 보기: http://stackoverflow.com/questions/11750223/apc-user-cache-entries-not-expiring
protected array $expires
리턴 array