PHP 클래스 Jamm\Memory\RedisObject

상속: extends MemoryObject, implements Jamm\Memory\IMemoryStorage
파일 보기 프로젝트 열기: jamm/memory 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$lock_key_prefix
$prefix
$redis Jamm\Memory\IRedisServer
$serialize_key_prefix
$tag_prefix

공개 메소드들

메소드 설명
__construct ( $ID = '', Jamm\Memory\IRedisServer $RedisServer = NULL )
add ( string $key, mixed $value, integer $ttl = 259200, array | string $tags = NULL ) : boolean Add value to the memory storage, only if this key does not exists (or false will be returned).
del ( string | array $keys ) : boolean | array Delete key or array of keys from storage
del_by_tags ( array | string $tags ) : boolean Delete keys by tags
del_old ( )
get_ID ( )
get_keys ( ) Return array of all stored keys
get_stat ( ) : array
increment ( string $key, mixed $by_value = 1, integer $limit_keys_count, integer $ttl = 259200 ) : integer | string | array Increment value of the key
lock_key ( mixed $key, mixed &$auto_unlocker_variable ) : boolean 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, mixed &$ttl_left ) : mixed Read data from memory storage
save ( string $key, mixed $value, integer $ttl = 259200, array | string $tags = NULL ) : boolean Save variable in memory storage
select_fx ( callable $fx, boolean $get_array = false ) : mixed Select from storage via callback function
setTags ( string $key, string | array $tags ) : boolean Set tags, associated with the key
set_ID ( $ID )
unlock_key ( KeyAutoUnlocker $auto_unlocker ) : boolean Unlock key, locked by method 'lock_key'

보호된 메소드들

메소드 설명
read_value ( $key, &$ttl_left ) : mixed | string
setDefaultRedisServer ( )
setKeySerialization ( $is_serialized, $key, $ttl )

메소드 상세

__construct() 공개 메소드

public __construct ( $ID = '', Jamm\Memory\IRedisServer $RedisServer = NULL )
$RedisServer Jamm\Memory\IRedisServer

add() 공개 메소드

Add value to the memory storage, only if this key does not exists (or false will be returned).
public add ( string $key, mixed $value, integer $ttl = 259200, array | string $tags = NULL ) : boolean
$key string
$value mixed
$ttl integer
$tags array | string
리턴 boolean

del() 공개 메소드

Delete key or array of keys from storage
public del ( string | array $keys ) : boolean | array
$keys string | array - keys
리턴 boolean | array - if array of keys was passed, on error will be returned array of not deleted keys, or 'true' on success.

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() 공개 메소드

public del_old ( )

get_ID() 공개 메소드

public get_ID ( )

get_keys() 공개 메소드

Return array of all stored keys
public get_keys ( )

get_stat() 공개 메소드

public get_stat ( ) : array
리턴 array

increment() 공개 메소드

Increment value of the 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 an array: if $by_value is a value in array, new element will be pushed to the end of array, if $by_value is a key=>value array, new 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 - set time to live for key
리턴 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 ) : boolean
$key mixed
$auto_unlocker_variable mixed - pass empty, just declared variable
리턴 boolean

read() 공개 메소드

Read data from memory storage
public read ( string | array $key, mixed &$ttl_left ) : mixed
$key string | array (string or array of string keys)
$ttl_left mixed = (ttl - time()) of key. Use to exclude dog-pile effect, with lock/unlock_key methods.
리턴 mixed

read_value() 보호된 메소드

protected read_value ( $key, &$ttl_left ) : mixed | string
$key
$ttl_left
리턴 mixed | string

save() 공개 메소드

Save variable in memory storage
public save ( string $key, mixed $value, integer $ttl = 259200, array | string $tags = NULL ) : boolean
$key string - key
$value mixed - value
$ttl integer - time to live (store) in seconds
$tags array | string - array of tags for this key
리턴 boolean

select_fx() 공개 메소드

Select from storage via callback function
public select_fx ( callable $fx, boolean $get_array = false ) : mixed
$fx callable ($value, $key) - should return true to select key(s)
$get_array boolean
리턴 mixed

setDefaultRedisServer() 보호된 메소드

protected setDefaultRedisServer ( )

setKeySerialization() 보호된 메소드

protected setKeySerialization ( $is_serialized, $key, $ttl )

setTags() 공개 메소드

Set tags, associated with the key
public setTags ( string $key, string | array $tags ) : boolean
$key string
$tags string | array
리턴 boolean

set_ID() 공개 메소드

public set_ID ( $ID )

unlock_key() 공개 메소드

Unlock key, locked by method 'lock_key'
public unlock_key ( KeyAutoUnlocker $auto_unlocker ) : boolean
$auto_unlocker KeyAutoUnlocker
리턴 boolean

프로퍼티 상세

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

protected $lock_key_prefix

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

protected $prefix

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

protected IRedisServer,Jamm\Memory $redis
리턴 Jamm\Memory\IRedisServer

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

protected $serialize_key_prefix

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

protected $tag_prefix