PHP Class Phalcon\Cache\Backend\Aerospike

Allows to cache output fragments, PHP data or raw data to a Aerospike backend. use Phalcon\Cache\Frontend\Data; use Phalcon\Cache\Backend\Aerospike as CacheBackend; Cache data for 2 days $frontCache = new Data(['lifetime' => 172800]); Create the Cache setting redis connection options $cache = new CacheBackend($frontCache, [ 'hosts' => [ ['addr' => '127.0.0.1', 'port' => 3000] ], 'persistent' => true, 'namespace' => 'test', 'prefix' => 'cache_', 'options' => [ \Aerospike::OPT_CONNECT_TIMEOUT => 1250, \Aerospike::OPT_WRITE_TIMEOUT => 1500 ] ]); Cache arbitrary data $cache->save('my-data', [1, 2, 3, 4, 5]); Get data $data = $cache->get('my-data');
Inheritance: extends Phalcon\Cache\Backend, implements Phalcon\Cache\BackendInterface, use trait Prefixable
Datei anzeigen Open project: phalcon/incubator Class Usage Examples

Protected Properties

Property Type Description
$db Aerospike The Aerospike DB
$namespace string Default Aerospike namespace
$set string The Aerospike Set for store cache

Public Methods

Method Description
__construct ( Phalcon\Cache\FrontendInterface $frontend, array $options ) Phalcon\Cache\Backend\Aerospike constructor
decrement ( string $keyName = null, integer $value = null ) : integer | false Decrement of $keyName by given $value
delete ( integer | string $keyName ) : boolean
exists ( string $keyName = null, integer $lifetime = null ) : boolean
get ( integer | string $keyName, integer $lifetime = null ) : mixed
getDb ( ) : Aerospike Gets the Aerospike instance.
increment ( string $keyName = null, integer $value = null ) : integer | false Increment of given $keyName by $value
queryKeys ( string $prefix = null ) : array
save ( integer | string $keyName = null, string $content = null, integer $lifetime = null, boolean $stopBuffer = true ) : boolean

Protected Methods

Method Description
buildKey ( string $key ) : array Generates a unique key used for storing cache data in Aerospike DB.

Method Details

__construct() public method

Phalcon\Cache\Backend\Aerospike constructor
public __construct ( Phalcon\Cache\FrontendInterface $frontend, array $options )
$frontend Phalcon\Cache\FrontendInterface Frontend Interface
$options array Constructor options

buildKey() protected method

Generates a unique key used for storing cache data in Aerospike DB.
protected buildKey ( string $key ) : array
$key string Cache key
return array

decrement() public method

Decrement of $keyName by given $value
public decrement ( string $keyName = null, integer $value = null ) : integer | false
$keyName string
$value integer
return integer | false

delete() public method

public delete ( integer | string $keyName ) : boolean
$keyName integer | string
return boolean

exists() public method

public exists ( string $keyName = null, integer $lifetime = null ) : boolean
$keyName string
$lifetime integer
return boolean

get() public method

public get ( integer | string $keyName, integer $lifetime = null ) : mixed
$keyName integer | string
$lifetime integer
return mixed

getDb() public method

Gets the Aerospike instance.
public getDb ( ) : Aerospike
return Aerospike

increment() public method

Increment of given $keyName by $value
public increment ( string $keyName = null, integer $value = null ) : integer | false
$keyName string
$value integer
return integer | false

queryKeys() public method

public queryKeys ( string $prefix = null ) : array
$prefix string
return array

save() public method

public save ( integer | string $keyName = null, string $content = null, integer $lifetime = null, boolean $stopBuffer = true ) : boolean
$keyName integer | string
$content string
$lifetime integer
$stopBuffer boolean
return boolean

Property Details

$db protected_oe property

The Aerospike DB
protected Aerospike,Phalcon\Cache\Backend $db
return Aerospike

$namespace protected_oe property

Default Aerospike namespace
protected string $namespace
return string

$set protected_oe property

The Aerospike Set for store cache
protected string $set
return string