PHP code example of chrisullyott / simple-cache

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

    

chrisullyott / simple-cache example snippets




use ChrisUllyott\Cache;
$cache = new Cache('cache_id');

$cache->set("Some data");

echo $cache->get(); // "Some data"

$cache->clear();



hrisUllyott\Cache;
$cache = new Cache('my_key');

$data = $cache->get();

if (!$data) {
    $data = my_api_request();
    $cache->set($data);
}

print_r($data);