PHP code example of toast / cache

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

    

toast / cache example snippets




use Toast\Cache\Cache;

$cache = new Cache('/path/to/storage');




use Toast\Cache\Cache;

$pool = Cache::getInstance('/path/to/storage');




use Toast\Cache\Cache;

$someVariable = 'I need to be cached!';

$pool = Cache::getInstance('/path/to/storage');
$pool->save('some-unique-key', $someVariable);
$pool->has('some-unique-key'); // true

// ...somewhere else in your code...

$item = Cache::getInstance('/path/to/storage')->get('some-unique-key');
echo $item; // string "I need to be cached!"