PHP code example of battis / simplecache

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

    

battis / simplecache example snippets


$mysqli = new mysqli('localhost', 'bob', 's00pers3kr3t', 'app-db'); // or whatever your credentials are
$cache = new \Battis\SimpleCache($mysqli);

$data = $cache->getCache('foo');
if ($data === false) {

  // ... lots and lots of work to create $data from scratch

  $cache->setCache('foo', $data); // cache for next use
}