PHP code example of denosyscore / cache

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

    

denosyscore / cache example snippets




enosys\Cache\FileCache;

$cache = new FileCache(sys_get_temp_dir() . '/my-app-cache');

$cache->set('greeting', 'Hello', 60);          // PSR-16: TTL in seconds
echo $cache->get('greeting', 'missing'), "\n";  // Hello

$cache->increment('visits', 1, 3600);           // atomic across processes; lives an hour
echo $cache->increment('visits', 2), "\n";      // 3
echo $cache->current('visits'), "\n";           // 3

$cache->clear();