Class Bicache
A two-level cache service
-
Wei\Base
-
Wei\BaseCache
-
Wei\Bicache
Methods summary
public
mixed
|
#
get( string $key, integer $expire = null, callable $fn = null )
Retrieve an item
Parameters
- $key
- The name of item
- $expire
- The expire seconds of callback return value
- $fn
- The callback to execute when cache not found
Returns
mixed
Throws
RuntimeException When set cache return false
|
public
boolean
|
#
set( string $key, mixed $value, integer $expire = 0 )
Store an item
Parameters
- $key
- The name of item
- $value
- The value of item
- $expire
- The expire seconds, defaults to 0, means never expired
Returns
boolean
|
public
boolean
|
#
remove( string $key )
Remove an item
Parameters
Returns
boolean
|
public
boolean
|
#
exists( string $key )
Check if an item is exists
Check if an item is exists
Parameters
Returns
boolean
|
public
boolean
|
#
add( string $key, mixed $value, integer $expire = 0 )
Add an item
Parameters
- $key
- The name of item
- $value
- The value of item
- $expire
- The expire seconds, defaults to 0, means never expired
Returns
boolean
|
public
boolean
|
#
replace( string $key, mixed $value, integer $expire = 0 )
Replace an existing item
Parameters
- $key
- The name of item
- $value
- The value of item
- $expire
- The expire seconds, defaults to 0, means never expired
Returns
boolean
|
public
integer|false
|
#
incr( string $key, integer $offset = 1 )
Increment an item
Parameters
- $key
- The name of item
- $offset
- The value to increased
Returns
integer|false Returns the new value on success, or false on failure
|
public
boolean
|
#
clear( )
Clear all items
Returns
boolean
|
protected
boolean
|
#
needUpdate( string $key )
Check if the key need to update to the slave cache
Check if the key need to update to the slave cache
Parameters
Returns
boolean
|
Properties summary
protected
array
|
$providers
|
#
array(
'master' => 'apc',
'slave' => 'fileCache',
)
|
protected
integer
|
$time
The seconds to update the slave cache
The seconds to update the slave cache
|
|