1. Go to this page and download the library: Download davidecesarano/embryo-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/ */
davidecesarano / embryo-cache example snippets
use Embryo\Cache\Cache;
use Embryo\Http\Emitter\Emitter;
use Embryo\Http\Factory\ResponseFactory;
$emitter = new Emitter;
$response = (new ResponseFactory)->createResponse(200);
$cachePath = __DIR__.DIRECTORY_SEPARATOR.'cache';
$cache = new Cache($cachePath);
if (!$cache->has('test')) {
$cache->set('test', 'Hello World!', 3600);
}
$body = $response->getBody();
$body->write($cache->get('test', 'Default value!'));
$response = $response->withBody($body);
$emitter->emit($response);