1. Go to this page and download the library: Download fsi/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/ */
fsi / cache example snippets
$cache->setNamespace('namespace-name');
$cache = new ArrayCache(array('namespace' => 'namespace-name'));
$cache = new ArrayCache();
$cache = new ApcCache();
$cache = new FileCache(array('directory' => '/tmp', 'dirlvl' => 3));
use FSi\Component\Cache\ApcCache;
// Create APC cache instance with default namespace.
$cache = new ApcCache();
// Check if there is a foo.
if ($cache->hasItem('foo')) {
echo 'foo exists in cache!';
} else {
// Store foo-value in cache under key foo for 3600 seconds.
$cache->setItem('foo', 'foo-value', 3600);
}
use FSi\Component\Cache\ApcCache;
// Create APC cache instance with default namespace.
$cache = new ApcCache();
$cache->setItem('key1', 'test', 0, 'testnamespace1');
$cache->setItem('key2', 'test', 0, 'testnamespace2');
$cache->hasItem('key1', 'testnamespace1'); // Will return true.
$cache->hasItem('key2', 'testnamespace2'); // Will return true.
$cache->hasItem('key2', 'testnamespace1'); // Will return false.
$cache->hasItem('key1', 'testnamespace2'); // Will return false.
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.