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
Afficher le fichier Open project: phalcon/incubator Class Usage Examples

Protected Properties

Свойство Type Description
$db Aerospike The Aerospike DB
$namespace string Default Aerospike namespace
$set string The Aerospike Set for store cache

Méthodes publiques

Méthode 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

Méthodes protégées

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

Method Details

__construct() public méthode

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 méthode

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

decrement() public méthode

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

delete() public méthode

public delete ( integer | string $keyName ) : boolean
$keyName integer | string
Résultat boolean

exists() public méthode

public exists ( string $keyName = null, integer $lifetime = null ) : boolean
$keyName string
$lifetime integer
Résultat boolean

get() public méthode

public get ( integer | string $keyName, integer $lifetime = null ) : mixed
$keyName integer | string
$lifetime integer
Résultat mixed

getDb() public méthode

Gets the Aerospike instance.
public getDb ( ) : Aerospike
Résultat Aerospike

increment() public méthode

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

queryKeys() public méthode

public queryKeys ( string $prefix = null ) : array
$prefix string
Résultat array

save() public méthode

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
Résultat boolean

Property Details

$db protected_oe property

The Aerospike DB
protected Aerospike,Phalcon\Cache\Backend $db
Résultat Aerospike

$namespace protected_oe property

Default Aerospike namespace
protected string $namespace
Résultat string

$set protected_oe property

The Aerospike Set for store cache
protected string $set
Résultat string