PHP code example of odan / cache

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

    

odan / cache example snippets


$cachePath = sys_get_temp_dir() . '/cache';

$cache = new \Odan\Cache\Simple\OpCache($cachePath);

// set a opcache value
$cache->set('foo', 'bar');

// get a opcache value
echo $cache->get('foo'); // bar

$cache->set('key', serialize($object));

$object = unserialize($cache->get('key'));