\Orpheus\CacheFSCache

The file system cache class

Uses File System to cache data. This class is useful for dated data. This class requires a CACHEPATH constant containing the path to the cache folder, you can also override getFolderPath() to determine the path by another way.

Summary

Methods
Properties
Constants
__construct()
get()
set()
getFolderPath()
getFilePath()
reset()
No public properties found
No constants found
No protected methods found
$path
$editTime
$ext
$delim
N/A
No private methods found
No private properties found
N/A

Properties

$path

$path : string

The path to the cache

Type

string

$editTime

$editTime : integer

The edit time to use

Type

integer

$ext

$ext : string

The extension of cache files

Type

string

$delim

$delim : string

The delimitator in cache file

Type

string

Methods

__construct()

__construct(string  $class, string  $name, integer  $editTime = null) 

Constructor

Parameters

string $class

The class of the cache

string $name

The name of this cache

integer $editTime

The last modification time of the cache. Default value is 0 (undefined).

get()

get(  $cached) : True

Get the cache for the given parameters

Parameters

$cached

The output to get the cache

Returns

True —

if cache has been retrieved

This method serializes the data in the file using json_encode(). The type is preserved, even for objects.

set()

set(  $data) : True

Set the cache for the given parameters

Parameters

$data

The data to put in the cache

Returns

True —

if cache has been saved

getFolderPath()

getFolderPath(  $class) : \Orpheus\Cache\The

Get the folder path for the cache

Parameters

$class

The class to use

Returns

\Orpheus\Cache\The —

path of this cache folder in the global cache folder.

getFilePath()

getFilePath(  $class,   $name) : \Orpheus\Cache\The

Get the fle path of this cache

Parameters

$class

The class to use

$name

The name to use

Returns

\Orpheus\Cache\The —

path of this cache file.

reset()

reset() : boolean

Reset the cache

Returns

boolean —

True in case of success This method uses the unlink() function.