PHP code example of hypernic / filecache

1. Go to this page and download the library: Download hypernic/filecache 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/ */

    

hypernic / filecache example snippets



ypernic\FileCache;

$cache = new FileCache();

// Store value for 60 seconds
$cache->set('my_key', 'hello world', 60);

// Retrieve
echo $cache->get('my_key'); // "hello world"

// Delete
$cache->delete('my_key');

// Counter demo
$cache->set('counter', 1, 3600);
$cache->increment('counter');   // 2
$cache->decrement('counter', 3); // -1

$cache = new FileCache([
    'cacheDirectory'         => __DIR__ . '/cache/',
    'gzipCompression'        => true,
    'compressionThreshold'   => 2048,
    'unixLoadUpperThreshold' => 4.0,
    'useApcu'                => true,
    'apcuTtl'                => 30,
    'fileExtension'          => 'cache',
    'lazyDelete'             => true
]);
bash
./vendor/bin/phpunit --bootstrap vendor/autoload.php tests/test.php