\Hazaar\Cache\Backend
File
The file cache backend.

This backend will cache data to the filesystem. It is basically a “works all the time” backend that is available regardless of what modules are installed or server software is available. It is very handing for using caching on systems where no other cache backends are available.

Available config options:

  • cache_dir – The directory to store cache files in. Default is to use a ‘cache’ directory in the application .runtime directory.
  • file_prefix – This is an optional prefix to apply to the cache files. Useful if you want to separate your cache files. Default: no prefix
  • use_zlib – Enable or disable zlib compression on the cache files. This can slow things down quite a bit more, but is useful when you are caching very large things. I wouldn’t bother using it under normal circumstances. Default: false.

Tags

Since

1.0.0

Summary
Methods Properties Constants
get
has
set
No constants
Properties
$cache_dir
$cache_dir
$local
$local
$namespace
$namespace
$timeout
$timeout
$timeout_file
$timeout_file
$weight
$weight
$zlib
$zlib
Methods
__destruct()
__destruct()
Store the namespace timeout in the cache dir timeout file.

This should only happen if a keepalive() has been called.

Static
available()
available()
clear()
clear()
get()
get($key)

Parameters

$key

No description

getAbsoluteFilename()
getAbsoluteFilename($key)

Parameters

$key

No description

has()
has($key) : boolean
Check if a value exists

Parameters

$keymixed

No description

Returns

boolean
init()
init($namespace)

Parameters

$namespace

No description

keepalive()
keepalive()
load()
load($key) : mixed
Load the key value from storage

This should only happen once and then it will be stored in memory and only written again when changed.

Tags

Throws

Exception\NoZlib

Parameters

$keymixed

The value key

Returns

mixed
remove()
remove($key)

Parameters

$key

No description

set()
set($key, $value, $timeout = null)

Parameters

$key

No description

$value

No description

$timeout

No description

toArray()
toArray()