PHP code example of twistor / lru-cache

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

    

twistor / lru-cache example snippets


use Twistor\LruCache;

$cache = new LruCache(100);

$cache->put('my_key', 1);

$cache->get('my_key');

$cache->getWith('new_key', function ($key) {
   return 2;
});