1. Go to this page and download the library: Download italystrap/storage 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/ */
if (false === ($special_data_to_save = \get_transient('special_data_to_save'))) {
// It wasn't there, so regenerate the data and save the transient
$special_data_to_save = ['some-key' => 'come value'];
\set_transient('special_data_to_save', $special_data_to_save, 12 * HOUR_IN_SECONDS);
}
declare(strict_types=1);
namespace Your\Namespace;
use ItalyStrap\Storage\Transient;
$transient = new Transient();
if (false === ($special_data_to_save = $transient->get('special_data_to_save'))) {
// It wasn't there, so regenerate the data and save the transient
$special_data_to_save = ['some-key' => 'come value'];
$transient->set('special_data_to_save', $special_data_to_save, 12 * HOUR_IN_SECONDS);
}
declare(strict_types=1);
namespace Your\Namespace;
use ItalyStrap\Storage\Cache;
$cache = new Cache();
if (false === ($special_data_to_save = $cache->get('special_data_to_save'))) {
// It wasn't there, so regenerate the data and save the transient
$special_data_to_save = ['some-key' => 'come value'];
$cache->set('special_data_to_save', $special_data_to_save, 12 * HOUR_IN_SECONDS);
}