PHP Class Pop\Cache\Cache

Author: Nick Sagona, III ([email protected])
ファイルを表示 Open project: nicksagona/PopPHP Class Usage Examples

Protected Properties

Property Type Description
$adapter mixed Cache adapter
$lifetime integer Lifetime value

Public Methods

Method Description
__construct ( Pop\Cache\Adapter\AdapterInterface $adapter, integer $lifetime ) : Cache Constructor
adapter ( ) : mixed Method to get the adapter
clear ( ) : void Method to clear all stored values from cache.
factory ( Pop\Cache\Adapter\AdapterInterface $adapter, integer $lifetime ) : Cache Static method to instantiate the cache object and return itself to facilitate chaining methods together.
getAdapters ( ) : array Static method to determine available adapters
getLifetime ( ) : integer Method to get the cache lifetime.
load ( string $id ) : mixed Method to load a value from cache.
remove ( string $id ) : void Method to delete a value in cache.
save ( string $id, mixed $value ) : void Method to save a value to cache.
setLifetime ( integer $time ) : Cache Method to set the cache lifetime.

Method Details

__construct() public method

Instantiate the cache object
public __construct ( Pop\Cache\Adapter\AdapterInterface $adapter, integer $lifetime ) : Cache
$adapter Pop\Cache\Adapter\AdapterInterface
$lifetime integer
return Cache

adapter() public method

Method to get the adapter
public adapter ( ) : mixed
return mixed

clear() public method

Method to clear all stored values from cache.
public clear ( ) : void
return void

factory() public static method

Static method to instantiate the cache object and return itself to facilitate chaining methods together.
public static factory ( Pop\Cache\Adapter\AdapterInterface $adapter, integer $lifetime ) : Cache
$adapter Pop\Cache\Adapter\AdapterInterface
$lifetime integer
return Cache

getAdapters() public static method

Static method to determine available adapters
public static getAdapters ( ) : array
return array

getLifetime() public method

Method to get the cache lifetime.
public getLifetime ( ) : integer
return integer

load() public method

Method to load a value from cache.
public load ( string $id ) : mixed
$id string
return mixed

remove() public method

Method to delete a value in cache.
public remove ( string $id ) : void
$id string
return void

save() public method

Method to save a value to cache.
public save ( string $id, mixed $value ) : void
$id string
$value mixed
return void

setLifetime() public method

Method to set the cache lifetime.
public setLifetime ( integer $time ) : Cache
$time integer
return Cache

Property Details

$adapter protected_oe property

Cache adapter
protected mixed $adapter
return mixed

$lifetime protected_oe property

Lifetime value
protected int $lifetime
return integer