PHP 클래스 Jamm\Memory\Shm\SingleMemory

상속: extends Jamm\Memory\MemoryObject, implements Jamm\Memory\Shm\ISingleMemory
파일 보기 프로젝트 열기: jamm/memory

보호된 프로퍼티들

프로퍼티 타입 설명
$mem
$sem Jamm\Memory\Shm\IMutex

공개 메소드들

메소드 설명
add ( string $key, mixed $value, integer $ttl = 2592000, string | array $tags = NULL ) : boolean | integer Add key to memory. If this key already exists - false will returned.
del ( string $key ) : boolean Delete key from memory
del_by_tags ( array | string $tags ) : boolean Delete keys by tags
del_old ( ) : boolean Delete old (by ttl) variables from storage
getSingleMemory ( )
get_keys ( ) Return array of all stored keys
increment ( string $key, mixed $by_value = 1, integer $limit_keys_count, integer $ttl = 259200 ) : integer | string | array Increment value of key
lock_key ( mixed $key, mixed &$auto_unlocker_variable ) Get exclusive mutex for key. Key will be still accessible to read and write, but another process can exclude dog-pile effect, if before updating the key he will try to get this mutex.
read ( string | array $key, &$ttl_left ) : mixed Read key value from memory
save ( string $key, mixed $value, integer $ttl = 2592000, string | array $tags = NULL ) : boolean | void
select_fx ( callable $fx, boolean $get_array = false ) : mixed Select from memory elements by function $fx
setMutex ( Jamm\Memory\Shm\IMutex $mutex )
unlock_key ( KeyAutoUnlocker $key_auto_unlocker ) : boolean Unlock key, locked by method 'lock_key'

보호된 메소드들

메소드 설명
get_key_ttl ( $key, &$mem )
readmemory ( )
refresh ( )

메소드 상세

add() 공개 메소드

Excludes simultaneously adding keys to exclude race condition.
public add ( string $key, mixed $value, integer $ttl = 2592000, string | array $tags = NULL ) : boolean | integer
$key string
$value mixed
$ttl integer
$tags string | array
리턴 boolean | integer

del() 공개 메소드

Delete key from memory
public del ( string $key ) : boolean
$key string
리턴 boolean

del_by_tags() 공개 메소드

Delete keys by tags
public del_by_tags ( array | string $tags ) : boolean
$tags array | string - tag or array of tags
리턴 boolean

del_old() 공개 메소드

Delete old (by ttl) variables from storage
public del_old ( ) : boolean
리턴 boolean

getSingleMemory() 공개 메소드

public getSingleMemory ( )

get_key_ttl() 보호된 메소드

protected get_key_ttl ( $key, &$mem )

get_keys() 공개 메소드

Return array of all stored keys
public get_keys ( )

increment() 공개 메소드

Increment value of key
public increment ( string $key, mixed $by_value = 1, integer $limit_keys_count, integer $ttl = 259200 ) : integer | string | array
$key string
$by_value mixed if stored value is array: if $by_value is value in array, new element will be pushed to the end of array, if $by_value is key=>value array, key=>value pair will be added (or updated)
$limit_keys_count integer - maximum count of elements (used only if stored value is array)
$ttl integer
리턴 integer | string | array new value of key

lock_key() 공개 메소드

Get exclusive mutex for key. Key will be still accessible to read and write, but another process can exclude dog-pile effect, if before updating the key he will try to get this mutex.
public lock_key ( mixed $key, mixed &$auto_unlocker_variable )
$key mixed
$auto_unlocker_variable mixed - pass empty, just declared variable

read() 공개 메소드

Read key value from memory
public read ( string | array $key, &$ttl_left ) : mixed
$key string | array
$ttl_left
리턴 mixed

readmemory() 추상적인 보호된 메소드

abstract protected readmemory ( )

refresh() 추상적인 보호된 메소드

abstract protected refresh ( )

save() 공개 메소드

public save ( string $key, mixed $value, integer $ttl = 2592000, string | array $tags = NULL ) : boolean | void
$key string key
$value mixed value
$ttl integer time to live
$tags string | array
리턴 boolean | void

select_fx() 공개 메소드

Select from memory elements by function $fx
public select_fx ( callable $fx, boolean $get_array = false ) : mixed
$fx callable
$get_array boolean
리턴 mixed

setMutex() 공개 메소드

public setMutex ( Jamm\Memory\Shm\IMutex $mutex )
$mutex Jamm\Memory\Shm\IMutex

unlock_key() 공개 메소드

Unlock key, locked by method 'lock_key'
public unlock_key ( KeyAutoUnlocker $key_auto_unlocker ) : boolean
$key_auto_unlocker Jamm\Memory\KeyAutoUnlocker
리턴 boolean

프로퍼티 상세

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

protected $mem

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

protected IMutex,Jamm\Memory\Shm $sem
리턴 Jamm\Memory\Shm\IMutex