\CodeIgniter\Cache\HandlersFileHandler

File system cache handler

Summary

Methods
Properties
Constants
__construct()
initialize()
get()
save()
delete()
increment()
decrement()
clean()
getCacheInfo()
getMetaData()
isSupported()
No public properties found
No constants found
getItem()
writeFile()
deleteFiles()
getDirFileInfo()
getFileInfo()
$prefix
$path
N/A
No private methods found
No private properties found
N/A

Properties

$prefix

$prefix : string

Prefixed to all cache names.

Type

string

$path

$path : string

Where to store cached files on the disk.

Type

string

Methods

__construct()

__construct(\CodeIgniter\Cache\Handlers\type  $config) 

Constructor.

Parameters

\CodeIgniter\Cache\Handlers\type $config

Throws

\CodeIgniter\Cache\Handlers\type

initialize()

initialize() 

Takes care of any handler-specific setup that must be done.

get()

get(string  $key) : mixed

Attempts to fetch an item from the cache store.

Parameters

string $key

Cache item name

Returns

mixed

save()

save(string  $key, mixed  $value, integer  $ttl = 60) : mixed

Saves an item to the cache store.

Parameters

string $key

Cache item name

mixed $value

The data to save

integer $ttl

Time To Live, in seconds (default 60)

Returns

mixed

delete()

delete(string  $key) : mixed

Deletes a specific item from the cache store.

Parameters

string $key

Cache item name

Returns

mixed

increment()

increment(string  $key, integer  $offset = 1) : mixed

Performs atomic incrementation of a raw stored value.

Parameters

string $key

Cache ID

integer $offset

Step/value to increase by

Returns

mixed

decrement()

decrement(string  $key, integer  $offset = 1) : mixed

Performs atomic decrementation of a raw stored value.

Parameters

string $key

Cache ID

integer $offset

Step/value to increase by

Returns

mixed

clean()

clean() : mixed

Will delete all items in the entire cache.

Returns

mixed

getCacheInfo()

getCacheInfo() : mixed

Returns information on the entire cache.

The information returned and the structure of the data varies depending on the handler.

Returns

mixed

getMetaData()

getMetaData(string  $key) : mixed

Returns detailed information about the specific item in the cache.

Parameters

string $key

Cache item name.

Returns

mixed

isSupported()

isSupported() : boolean

Determines if the driver is supported on this system.

Returns

boolean

getItem()

getItem(string  $key) : boolean|mixed

Does the heavy lifting of actually retrieving the file and verifying it's age.

Parameters

string $key

Returns

boolean|mixed

writeFile()

writeFile(  $path,   $data, string  $mode = 'wb') : boolean

Writes a file to disk, or returns false if not successful.

Parameters

$path
$data
string $mode

Returns

boolean

deleteFiles()

deleteFiles(string  $path, boolean  $del_dir = false, boolean  $htdocs = false, integer  $_level) : boolean

Delete Files

Deletes all files contained in the supplied directory path. Files must be writable or owned by the system in order to be deleted. If the second parameter is set to TRUE, any directories contained within the supplied base directory will be nuked as well.

Parameters

string $path

File path

boolean $del_dir

Whether to delete any directories found in the path

boolean $htdocs

Whether to skip deleting .htaccess and index page files

integer $_level

Current directory depth level (default: 0; internal use only)

Returns

boolean

getDirFileInfo()

getDirFileInfo(string  $source_dir, boolean  $top_level_only = true, boolean  $_recursion = false) : array|false

Get Directory File Information

Reads the specified directory and builds an array containing the filenames, filesize, dates, and permissions

Any sub-folders contained within the specified path are read as well.

Parameters

string $source_dir

Path to source

boolean $top_level_only

Look only at the top level directory specified?

boolean $_recursion

Internal variable to determine recursion status - do not use in calls

Returns

array|false

getFileInfo()

getFileInfo(string  $file, mixed  $returned_values = array('name', 'server_path', 'size', 'date')) : array|false

Get File Info

Given a file and path, returns the name, path, size, date modified Second parameter allows you to explicitly declare what information you want returned Options are: name, server_path, size, date, readable, writable, executable, fileperms Returns FALSE if the file cannot be found.

Parameters

string $file

Path to file

mixed $returned_values

Array or comma separated string of information returned

Returns

array|false