PHP code example of dazzle-php / cache

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

    

dazzle-php / cache example snippets


$loop  = new Loop();
$cache = new Cache($loop);

$cache->start()->then(function(CacheInterface $cache) {

    $chain = new Promise();
    $chain = $chain->then(function() use($cache) {
        return $cache->set('SOME_KEY', "DAZZLE IS AWESOME\n");
    });
    $chain = $chain->then(function() use($cache) {
        return $cache->get('SOME_KEY');
    });
    $chain = $chain->then(function($result) {
        printf("%s", $result);
        return $cache->end();
    });
    return $chain;
});

$loop->start();