Adrián Mouly
01/26/2022, 11:51 PM/**
* The name of TTL attribute.
*
* @default - TTL is disabled
* @stability stable
*/
readonly timeToLiveAttribute?: string;
What should be the value?Adam Fanello
01/26/2022, 11:55 PMAdrián Mouly
01/26/2022, 11:55 PMAdrián Mouly
01/26/2022, 11:55 PMAdrián Mouly
01/26/2022, 11:55 PMAdam Fanello
01/26/2022, 11:56 PMnew Date().getTime() / MillisecondsInSecond
Adrián Mouly
01/26/2022, 11:56 PMAdam Fanello
01/26/2022, 11:56 PMAdrián Mouly
01/26/2022, 11:57 PMAdam Fanello
01/26/2022, 11:57 PMconst now = new Date();
const historySeconds = (await this.historyDays.get()) * SecondsInDay;
const ttl = Math.floor(now.getTime() / MillisecondsInSecond) + historySeconds;
Derek Kershner
01/27/2022, 12:05 AMexpiresAt
.
I also recommend the lib ms
to easily add time.Adrián Mouly
01/27/2022, 12:17 AMMichael Clifford
01/27/2022, 5:50 PM