From 5557aae5438b0f5b01b2d376de987c44f40f736e Mon Sep 17 00:00:00 2001 From: garrettmills Date: Tue, 13 Sep 2022 23:21:44 -0500 Subject: [PATCH] Fix order of dates in redis expiration calculation --- package.json | 2 +- src/support/cache/RedisCache.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c0c00e5..460e7c4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@extollo/lib", - "version": "0.14.3", + "version": "0.14.4", "description": "The framework library that lifts up your code.", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/src/support/cache/RedisCache.ts b/src/support/cache/RedisCache.ts index 0f73c53..05936af 100644 --- a/src/support/cache/RedisCache.ts +++ b/src/support/cache/RedisCache.ts @@ -76,7 +76,7 @@ export class RedisCache extends Cache { await this.redis.multi() .tap(redis => redis.set(key, value)) .when(Boolean(expires), redis => { - const seconds = Math.round(((new Date()).getTime() - expires!.getTime()) / 1000) // eslint-disable-line @typescript-eslint/no-non-null-assertion + const seconds = Math.round((expires!.getTime() - (new Date()).getTime()) / 1000) // eslint-disable-line @typescript-eslint/no-non-null-assertion return redis.expire(key, seconds) }) .tap(pipeline => pipeline.exec())