PHP code example of adinan-cenci / file-cache

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

    

adinan-cenci / file-cache example snippets


use AdinanCenci\FileCache\Cache;
$cache = new Cache('my-cache-directory/');

$cache->set('somethingCostlyToAcquire', $value, 60 * 60 * 24);

$cache->setMultiple([
    'foo'           => $bar,
    'hello'         => $world,
    'myObject'      => $myObject
], 60 * 60 * 24);

$fallback = 'nothing here';
$cache->get('somethingCostlyToAcquire', $fallback);

$cache->getMultiple([
    'object1', 
    'value1',
    'anotherObject'
], $fallback);