PHP code example of badtomcat / cache
1. Go to this page and download the library: Download badtomcat/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/ */
badtomcat / cache example snippets
$cache = new Badtomcat\Cache\FileCache(__DIR__."/cache");
$cache->set('key', 'taw');
$this->assertEquals($cache->get('key'), 'taw');
$cache->set('balabala', 'balabala',1);
$this->assertEquals($cache->get('balabala'), 'balabala');
sleep(2);
$this->assertEquals($cache->get('balabala'), null);
$cache->flush();