PHP Class Prado\I18N\core\MessageCache

It can cache each cataloug+variant or just the whole section.
Author: $Author: weizhuo $
Show file Open project: pradosoft/prado Class Usage Examples

Protected Properties

Property Type Description
$cache TCache_Lite Cache Lite instance.
$lifetime Caceh life time, default is 1 year.

Public Methods

Method Description
__construct ( string $cacheDir ) Create a new Translation cache.
clean ( string $catalogue, string $culture ) Clean up the cache for the specified section and locale.
clear ( ) Flush the cache. Deletes all the cache files.
get ( string $catalogue, string $culture, $lastmodified ) : mixed Get the data from the cache.
getLifeTime ( ) : integer Get the cache life time.
save ( array $data, string $catalogue, string $culture ) Save the data to cache for the specified section and locale.
setLifeTime ( integer $time ) Set the cache life time.

Protected Methods

Method Description
getGroup ( string $catalogue, string $culture ) Get the cache file GROUP based section and locale.
getID ( string $catalogue, string $culture ) Get the cache file ID based section and locale.

Method Details

__construct() public method

Create a new Translation cache.
public __construct ( string $cacheDir )
$cacheDir string Directory to store the cache files.

clean() public method

Clean up the cache for the specified section and locale.
public clean ( string $catalogue, string $culture )
$catalogue string The translation section.
$culture string The translation locale, e.g. "en_AU".

clear() public method

Flush the cache. Deletes all the cache files.
public clear ( )

get() public method

Get the data from the cache.
public get ( string $catalogue, string $culture, $lastmodified ) : mixed
$catalogue string The translation section.
$culture string The translation locale, e.g. "en_AU".
return mixed Boolean FALSE if no cache hit. Otherwise, translation table data for the specified section and locale.

getGroup() protected method

Get the cache file GROUP based section and locale.
protected getGroup ( string $catalogue, string $culture )
$catalogue string The translation section.
$culture string The translation locale, e.g. "en_AU".

getID() protected method

Get the cache file ID based section and locale.
protected getID ( string $catalogue, string $culture )
$catalogue string The translation section.
$culture string The translation locale, e.g. "en_AU".

getLifeTime() public method

Get the cache life time.
public getLifeTime ( ) : integer
return integer Cache life time.

save() public method

Save the data to cache for the specified section and locale.
public save ( array $data, string $catalogue, string $culture )
$data array The data to save.
$catalogue string The translation section.
$culture string The translation locale, e.g. "en_AU".

setLifeTime() public method

Set the cache life time.
public setLifeTime ( integer $time )
$time integer Cache life time.

Property Details

$cache protected property

Cache Lite instance.
protected TCache_Lite,Prado\I18N\core $cache
return TCache_Lite

$lifetime protected property

Caceh life time, default is 1 year.
protected $lifetime