This class contains functions for the file cache in CONTENIDO.

package Core
subpackage Cache

 Methods

Constructor.

__construct(array $options) : void

Parameters

$options

array

array with options for the cache (optional, default: empty array)

Generates the filename based on set options.

generateFileName(string $id, string $group) : string

Parameters

$id

string

cache ID

$group

string

cache group

Returns

stringfilename

Generates a ID for the given variables.

generateID($variables) : string

Parameters

$variables

Returns

stringgenerated ID

Return content of a specific cache stored in filesystem.

get(string $id, string $group) : bool | string

If not cached, false is returned.

Parameters

$id

string

cache ID

$group

string

cache group

Returns

boolstringcontent or false

Returns full destination to the cache file.

getDestination(string $id, string $group) : string

Parameters

$id

string

cache ID

$group

string

cache group

Returns

stringfull filename

Removes cache from filesystem.

remove(string $id, string $group) : bool

Parameters

$id

string

cache ID

$group

string

cache group

Returns

boolsuccess state

Saves the content of a cache in filesystem.

save(string $data, string $id, string $group) : bool

Parameters

$data

string

data to save

$id

string

cache ID

$group

string

cache group

Returns

boolsuccess state

Setter for the cache options.

setOptions(array $options) : void

Validates incoming options and sets the default of the missing options.

Parameters

$options

array

array with option

Validates the caching directory and throws exception on error.

_validateDirectory() : void

 Properties

 

$_options : array