PHP code example of sarahman / json-filesystem-cache

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

    

sarahman / json-filesystem-cache example snippets




e = new Sarahman\SimpleCache\JSONFileSystemCache(); // the custom cache directory can be set through the parameter.

// Set Cache key.
$data = [
    'sample' => 'data',
    'another' => 'data'
];

$cache->set('your_custom_key', $data);

// Check cached key exists or not.
$cache->has('your_custom_key');

// Get Cached key data.
$cache->get('your_custom_key');