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
Mostrar archivo Open project: bluzphp/framework Class Usage Examples

Protected Properties

Property Type Description
$adapter Instance of cache adapter
$prefix Prefix for cache keys
$tagAdapter Instance of tag adapter
$tagPrefix Prefix for tags

Public Methods

Method 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

Protected Methods

Method 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 method

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

addTag() public method

public addTag ( string $id, string $tag ) : boolean
$id string
$tag string
return boolean

contains() public method

public contains ( string $id ) : boolean
$id string
return boolean

delete() public method

public delete ( string $id ) : mixed
$id string
return mixed

deleteByTag() public method

public deleteByTag ( string $tag ) : boolean
$tag string
return boolean

flush() public method

public flush ( ) : void
return void

get() public method

public get ( string $id ) : mixed
$id string
return mixed

getAdapter() public method

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

getTagAdapter() public method

Get underlying tag adapter
public getTagAdapter ( ) : Bluz\Cache\CacheInterface
return Bluz\Cache\CacheInterface

initAdapter() protected method

Initialize adapter
protected initAdapter ( string $adapterName ) : Bluz\Cache\CacheInterface
$adapterName string
return Bluz\Cache\CacheInterface

initOptions() protected method

Check Cache configuration
protected initOptions ( ) : void
return void

prepareId() protected method

Prepare Id with prefix
protected prepareId ( string $id ) : string
$id string
return string

set() public method

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

setPrefix() public method

Setup prefix for cache records
public setPrefix ( string $prefix ) : void
$prefix string
return void

setTagPrefix() public method

Setup prefix for cache records of tags
public setTagPrefix ( string $prefix ) : void
$prefix string
return 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