PHP code example of cicnavi / simple-file-cache-php
1. Go to this page and download the library: Download cicnavi/simple-file-cache-php 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/ */
cicnavi / simple-file-cache-php example snippets
use Cicnavi\SimpleFileCache\SimpleFileCache;
$cache = new SimpleFileCache('some-cache-name', '/some/writable/storage/folder');
// Alternatively, instantiate it using defaults...
// $cache = new SimpleFileCache('some-cache-name'); // Use specific cache name, but use default system 'tmp' folder
// $cache = new SimpleFileCache(); // Use default cache name and default system 'tmp' folder
$somethingImportant = 'This string was fetched from API using HTTP request, which is expensive. I\'ll store it
in cache for later use so I don\'t have to make another HTTP request for the same thing';
// Use any of the PSR-16 metods to work with cache...:
$cache->set('somethingImportant', $somethingImportant);
//... later
$somethingImportant = $cache->get('somethingImportant');
shell script
composer