1. Go to this page and download the library: Download ajimoti/cache-duration 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/ */
$cacheDuration = Duration::at('first day of January 2023'); // returns the time difference between the present time and the first of january 2023 in seconds
Redis::expire($userData, $cacheDuration);
// The formula = camelCaseOfTheNumberInWords + Unit
Duration::thirtySevenDays(); // returns the number of seconds in 37 days
use Ajimoti\CacheDuration\Duration;
$cacheDuration = Duration::seconds(30); // returns 30
// or dynamically
$cacheDuration = Duration::thirtySeconds(); // returns 30
use Ajimoti\CacheDuration\Duration;
$cacheDuration = Duration::minutes(55); // returns 55 minutes in seconds (55 * 60)
// or dynamically
$cacheDuration = Duration::fiftyFiveMinutes(); // returns 55 minutes in seconds (55 * 60)
use Ajimoti\CacheDuration\Duration;
$cacheDuration = Duration::hours(7); // returns 7 hours in seconds (7 * 60 * 60)
// or dynamically
$cacheDuration = Duration::sevenHours(); // returns 7 hours in seconds (7 * 60 * 60)
use Ajimoti\CacheDuration\Duration;
$cacheDuration = Duration::days(22); // returns 22 days in seconds (22 * 24 * 60 * 60)
// or dynamically
$cacheDuration = Duration::twentyTwoDays(); // returns 22 days in seconds (22 * 24 * 60 * 60)
use Date;
use Carbon\Carbon;
use Ajimoti\CacheDuration\Duration;
// Carbon instance
$cacheDuration = Duration::at(Carbon::now()->addMonths(3)); // returns time in seconds between the present timestamp and three months time
// Datetime instance
$cacheDuration = Duration::at(new DateTime('2039-09-30')); // returns time in seconds between the present timestamp and the date passed (2039-09-30).
// String
$cacheDuration = Duration::at('first day of January 2023'); // returns time in seconds between the present timestamp and the first of January 2023.
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.