PHP Class Bluz\Cache\Cache

Configuration 'enabled' => true, // Boolean,optional, true by default 'cacheAdapter' => 'redis', // Required if option 'enabled' set to true 'tagAdapter' => 'memcached', // Optional 'settings' => [ 'redis' => [], // Settings for setup Instance of Bluz\Cache\CacheInterface. 'memcached' => [], // Settings for another cache adapter ]
Inheritance: implements Bluz\Cache\CacheInterface, implements Bluz\Cache\TagableInterface, use trait Bluz\Common\Options
Afficher le fichier Open project: bluzphp/framework Class Usage Examples

Protected Properties

Свойство Type Description
$adapter Instance of cache adapter
$prefix Prefix for cache keys
$tagAdapter Instance of tag adapter
$tagPrefix Prefix for tags

Méthodes publiques

Méthode Description
add ( string $id, mixed $data, integer $ttl = Cache::TTL_NO_EXPIRY ) : boolean
addTag ( string $id, string $tag ) : boolean
contains ( string $id ) : boolean
delete ( string $id ) : mixed
deleteByTag ( string $tag ) : boolean
flush ( ) : void
get ( string $id ) : mixed
getAdapter ( string $adapterName = null ) : Bluz\Cache\CacheInterface Get underlying cache adapter
getTagAdapter ( ) : Bluz\Cache\CacheInterface Get underlying tag adapter
set ( string $id, mixed $data, integer $ttl = Cache::TTL_NO_EXPIRY ) : boolean
setPrefix ( string $prefix ) : void Setup prefix for cache records
setTagPrefix ( string $prefix ) : void Setup prefix for cache records of tags

Méthodes protégées

Méthode Description
initAdapter ( string $adapterName ) : Bluz\Cache\CacheInterface Initialize adapter
initOptions ( ) : void Check Cache configuration
prepareId ( string $id ) : string Prepare Id with prefix

Method Details

add() public méthode

public add ( string $id, mixed $data, integer $ttl = Cache::TTL_NO_EXPIRY ) : boolean
$id string
$data mixed
$ttl integer
Résultat boolean

addTag() public méthode

public addTag ( string $id, string $tag ) : boolean
$id string
$tag string
Résultat boolean

contains() public méthode

public contains ( string $id ) : boolean
$id string
Résultat boolean

delete() public méthode

public delete ( string $id ) : mixed
$id string
Résultat mixed

deleteByTag() public méthode

public deleteByTag ( string $tag ) : boolean
$tag string
Résultat boolean

flush() public méthode

public flush ( ) : void
Résultat void

get() public méthode

public get ( string $id ) : mixed
$id string
Résultat mixed

getAdapter() public méthode

Get underlying cache adapter
public getAdapter ( string $adapterName = null ) : Bluz\Cache\CacheInterface
$adapterName string
Résultat Bluz\Cache\CacheInterface

getTagAdapter() public méthode

Get underlying tag adapter
public getTagAdapter ( ) : Bluz\Cache\CacheInterface
Résultat Bluz\Cache\CacheInterface

initAdapter() protected méthode

Initialize adapter
protected initAdapter ( string $adapterName ) : Bluz\Cache\CacheInterface
$adapterName string
Résultat Bluz\Cache\CacheInterface

initOptions() protected méthode

Check Cache configuration
protected initOptions ( ) : void
Résultat void

prepareId() protected méthode

Prepare Id with prefix
protected prepareId ( string $id ) : string
$id string
Résultat string

set() public méthode

public set ( string $id, mixed $data, integer $ttl = Cache::TTL_NO_EXPIRY ) : boolean
$id string
$data mixed
$ttl integer
Résultat boolean

setPrefix() public méthode

Setup prefix for cache records
public setPrefix ( string $prefix ) : void
$prefix string
Résultat void

setTagPrefix() public méthode

Setup prefix for cache records of tags
public setTagPrefix ( string $prefix ) : void
$prefix string
Résultat void

Property Details

$adapter protected_oe property

Instance of cache adapter
protected $adapter

$prefix protected_oe property

Prefix for cache keys
protected $prefix

$tagAdapter protected_oe property

Instance of tag adapter
protected $tagAdapter

$tagPrefix protected_oe property

Prefix for tags
protected $tagPrefix