PHP Class Microweber\Providers\CacheManager

These functions will allow you to save and get data from the MW cache system
Show file Open project: microweber/microweber

Public Properties

Property Type Description
$adapter An instance of the cache adapter to use.
$app An instance of the Microweber Application class.

Public Methods

Method Description
__construct ( $app = null )
clear ( ) : boolean Clears all cache data.
debug ( ) : array Prints cache debug information.
delete ( string $cache_group = 'global' ) : boolean Deletes cache for given $cache_group recursively.
get ( string $cache_id, string $cache_group = 'global', boolean $timeout = false ) : mixed Gets the data from the cache.
save ( mixed $data_to_cache, string $cache_id, string $cache_group = 'global', $expiration = false ) : boolean Stores your data in the cache.

Method Details

__construct() public method

public __construct ( $app = null )

clear() public method

Clears all cache data.
public clear ( ) : boolean
return boolean

debug() public method

Prints cache debug information.
public debug ( ) : array
return array

delete() public method

Deletes cache for given $cache_group recursively.
public delete ( string $cache_group = 'global' ) : boolean
$cache_group string (default is 'global') - this is the subfolder in the cache dir.
return boolean

get() public method

If data is not found it return false *
public get ( string $cache_id, string $cache_group = 'global', boolean $timeout = false ) : mixed
$cache_id string id of the cache
$cache_group string (default is 'global') - this is the subfolder in the cache dir.
$timeout boolean
return mixed returns array of cached data or false

save() public method

It can store any value that can be serialized, such as strings, array, etc.
public save ( mixed $data_to_cache, string $cache_id, string $cache_group = 'global', $expiration = false ) : boolean
$data_to_cache mixed your data, anything that can be serialized
$cache_id string id of the cache, you must define it because you will use it later to retrieve the cached content.
$cache_group string (default is 'global') - this is the subfolder in the cache dir.
return boolean

Property Details

$adapter public property

An instance of the cache adapter to use.
public $adapter

$app public property

An instance of the Microweber Application class.
public $app