1. Go to this page and download the library: Download php-strict/storable-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/ */
php-strict / storable-cache example snippets
use PhpStrict\Config\Config;
use PhpStrict\StorableCache\StorableCache;
//instance of application configuration class, extending Config
//must provide cacheType property with correct storable cache type
//see PhpStrict\StorableCache\StorageTypes class
$config = new AppConfig();
$config->loadFromFile('config.ini');
//instance of StorableCache
$cache = new StorableCache($config);
//part of generating content method
if ($cache->has('contentKey') && !$cache->expired('contentKey')) {
return $cache->get('contentKey');
}
//part of generating content method
//saving generated content: key, value, ttl, tts (time to save)
$cache->set('contentKey', $content, 60, 3600);
use PhpStrict\StorableCache\StorableCache;
//part of generating content method
//generating content failed
if ($cache->has('contentKey')) {
return $cache->get('contentKey');
}
throw Exception('Generating content failed');
//part of generating content method
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.