FacturaScripts

FileCache implements AdaptorInterface

Simple file cache This class is great for those who can't use apc or memcached in their projects.

Table of Contents

$config Cache configuration array
__construct() FileCache constructor. mixed
clear() Flush all cache. bool
delete() Delete data from cache. bool
get() Get the data associated with a key. mixed
set() Put content into the cache. bool
getRoute() Get a route to the file associated to that key. string
fileExpired() Check if a file has expired or not. bool
toolBox() ToolBox

Properties

$config

Cache configuration

private static array $config

Methods

__construct()

FileCache constructor.

public __construct( ) : mixed
Return values
mixed

clear()

Flush all cache.

public clear( ) : bool
Return values
bool

always true

delete()

Delete data from cache.

public delete( $key : string ) : bool
Parameters
$key : string
Return values
bool

true if the data was removed successfully

get()

Get the data associated with a key.

public get( $key : string ) : mixed
Parameters
$key : string
Return values
mixed

the content you put in, or null if expired or not found

set()

Put content into the cache.

public set( $key : string , $content : mixed , $expire : int ) : bool
Parameters
$key : string
$content : mixed

the the content you want to store

$expire : int

time to expire

Return values
bool

whether if the operation was successful or not

getRoute()

Get a route to the file associated to that key.

private getRoute( $key : string ) : string
Parameters
$key : string
Return values
string

the filename of the php file

fileExpired()

Check if a file has expired or not.

private fileExpired( $file : string ) : bool
Parameters
$file : string

the rout to the file

Return values
bool

if the file has expired or not

Search results