\duncan3dc\HelpersDiskCache

Summary

Methods
Properties
Constants
path()
check()
get()
set()
clear()
call()
$path
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$path

$path : string

Type

string — The base path to use for cache storage

Methods

path()

path(string $filename) : string

Generate the fullpath to the cache file based on the passed filename.

Parameters

string $filename

The filename specified to store the cache in

Returns

string

check()

check(string $filename) : integer|null

Check if the specified key has already been cached.

If it has been cached then the time the cached data was last modified is returned.

Parameters

string $filename

The key of the cached data

Returns

integer|null

get()

get(string $filename, integer $mins) : mixed

Get the stored value of the specified key.

Parameters

string $filename

The key of the cached data

integer $mins

The number of minutes to use the cache for, if the cache is present but older than this time then return null

Returns

mixed

set()

set(string $filename, string $data) : void

Set the specified key to the specified value.

Parameters

string $filename

The key of the cached data

string $data

The value to storage against the key, this data must be JSON serializable

clear()

clear(string $filename) : void

Clear a key within the cache data.

Parameters

string $filename

The key of the cached data

call()

call(string $key, callable $func) : mixed

Convience method to retrieve a value if it's cached, or run the callback and cache the data now if not.

Parameters

string $key

The key of the cached data

callable $func

A function to call that will return the value to cache

Returns

mixed