PHP code example of duncan3dc / cache

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

    

duncan3dc / cache example snippets


$cache = new \duncan3dc\Cache\FilesystemPool(sys_get_temp_dir());

# The $cache object implements PSR-6
$userData = $cache->getItem("user_data")->get();

# ...and PSR-16
$userData = $cache->get("user_data");

$cache = new \duncan3dc\Cache\ArrayPool();

# The $cache object implements PSR-6
$userData = $cache->getItem("user_data")->get();

# ...and PSR-16
$userData = $cache->get("user_data");

$cache = new class {
    use \duncan3dc\Cache\CacheCallsTrait;

    public function _getData()
    {
        return [];
    }
};

$cache->getData();