PHP code example of cache / util

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

    

cache / util example snippets


use function Cache\Util\SimpleCache\remember;

$cache = new SimpleCache(); // some simple cache interface

// if the result exists at the key, it'll return from cache, else it'll execute the callback and store in cache and return.
$res = remember($cache, 'key', 3600, function() {
    return someExpensiveOperation();
});