PHP code example of vitrexphp / cache

1. Go to this page and download the library: Download vitrexphp/cache library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vitrexphp / cache example snippets




use Vitrex\Cache\Cache;
use Vitrex\Cache\Adapter;

$File = new Adapter\File(__DIR__);
$Session = new Adapter\Session();
$MemCached = new Adapter\Memcached();

/* Then inject one of the adapters into the main cache object */
$Cache = new Cache($File);


if (($cacheData = $Cache->load('Foo')) === false) {
	$cacheData = [
		'Name'     => 'Vitrex PHP Cache',
		'Class'    => Cache::class,
		'LifeTime' => Adapter\Adapter::LIFE_TIME_1_WEEK,
		'Foo'      => 'Bar'
	];
	$Cache->save('Foo', $cacheData, '1 WEEK');
}
var_dump($cacheData);

$Cache->delete('Foo');

$Cache->clearAll();