PHP code example of zer0-framework / cache

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

    

zer0-framework / cache example snippets


$pool = $this->app->factory('CachePool');
$user = $pool->item('user.' . $userId)->setCallback(function (Item $item) use ($userId) {
  $item
  ->expiresAfter(60 * 60 * 24)
  ->set(getUserFromDatabase($userId))
  ->save();
})->get();