\hymie\cacheArrayCache

简单的符合 psr-16 标准的数组缓存实现。

数组结构为: [key] => ['value' => value, 'expire'=>['ttl'=> ttl, expire_at => expire-at];

缓存 ttl 以秒为单位。

Summary

Methods
Properties
Constants
__construct()
get()
set()
delete()
clear()
getMultiple()
setMultiple()
deleteMultiple()
has()
No public properties found
EXPIRE_KEY
TTL_KEY
EXPIRE_AT_KEY
VALUE_KEY
No protected methods found
No protected properties found
N/A
stringKey()
getValue()
createItem()
$pool
N/A

Constants

EXPIRE_KEY

EXPIRE_KEY

到期时间键

TTL_KEY

TTL_KEY

time to live 键

EXPIRE_AT_KEY

EXPIRE_AT_KEY

失效时间

VALUE_KEY

VALUE_KEY

数据键

Properties

$pool

$pool : array

缓存容器数组

Type

array

Methods

__construct()

__construct() 

构造函数

get()

get(  $key,   $default = null) 

{@inheritdoc}

Parameters

$key
$default

set()

set(  $key,   $value,   $ttl = null) 

{@inheritdoc}

Parameters

$key
$value
$ttl

delete()

delete(  $key) 

{@inheritdoc}

Parameters

$key

clear()

clear() 

{@inheritdoc}

getMultiple()

getMultiple(  $keys,   $default = null) 

{@inheritdoc}

Parameters

$keys
$default

setMultiple()

setMultiple(  $values,   $ttl = null) 

{@inheritdoc}

Parameters

$values
$ttl

deleteMultiple()

deleteMultiple(  $keys) 

{@inheritdoc}

Parameters

$keys

has()

has(  $key) 

{@inheritdoc}

Parameters

$key

stringKey()

stringKey(\hymie\cache\mix  $key) : boolean

检查键是否为字符串并且不是空字符串

Parameters

\hymie\cache\mix $key

Returns

boolean

getValue()

getValue(string  $key, mixed  $default) : mixed

获取缓存值,如果键不存在则返回 $default 值

Parameters

string $key
mixed $default

Returns

mixed

createItem()

createItem(mixed  $value, \hymie\cache\time  $ttl) : array

创建缓存数组项

Parameters

mixed $value
\hymie\cache\time $ttl

Returns

array