PHP code example of yiranzai / file-cache
1. Go to this page and download the library: Download yiranzai/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/ */
yiranzai / file-cache example snippets
$cache = new Yiranzai\File\Cache();
$cache->put('key', 'data', 10);
$cache->put('key1', 'data1', new DateTime());
$cache->put('key2', 'data2', 'now');
$cache->forever('key3', 'data3');
$cache->get('key'); // data
$cache->delete('key'); // true
$cache->flush();
$cache->get('not_exists','nothing'); // nothing
$cache->dataPath('YOUR_PATH');
// or
$cache = new Yiranzai\File\Cache(['dataPath'=>'YOUR_PATH']);