PHP code example of biohzrdmx / cacher-php

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

    

biohzrdmx / cacher-php example snippets


$cacher = new Cacher(dirname(__FILE__) . '/cache');

$cacher->store('results', $results);

$cacher->isCached('results');

$results = $cacher->retrieve('results');

use Cacher\Cacher;

$cacher = new Cacher(BASE_DIR . '/cache');

if ( $cacher->isCached('results') ) {
  $results = $cacher->retrieve('results');
} else {
  $results = fetchResultsFromSomeSource();
  $cacher->store('results', $results);
}