sFire PHP Framework

File system cache adapter

sFire\Cache\Adapter\Filesystem is an adapter for sFire\Cache\Cache and is based on the file system to store and retrieve data. By default, it will store all the cache in the "data/cache/shared/" folder.

In this section we will handle:

  • Setting the cache adapter
  • Usage

Setting the cache adapter

To set-up the cache adapter, you need to inject the driver into a new instance of sFire\Cache\Cache. You can do so by injecting the driver into the constructor, or by calling the setDriver method.

Constructor
use sFire\Cache\Cache;

$cache = new Cache('Filesystem');
Set adapter
use sFire\Cache\Cache;

$cache = new Cache();
$cache -> setDriver('Filesystem');

Usage

For the documentation about the usage of this driver, you can view the sFire\Cache\Cache.