PHP code example of pspychalski / phpcache

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

    

pspychalski / phpcache example snippets



\PhpCache\PhpCache::$sDefaultMechanism = 'Redis';
$cache = \PhpCache\Factory::getInstance()->create();

$key = new \PhpCache\CacheKey('myKey');
$cache->set($key, 'Lorem ipsum');
if ($cache->check($key)) {
    var_dump($cache->get($key));
} else {
    var_dump('Data not found');
}