diff --git a/packages/backend-core/src/cache/generic.ts b/packages/backend-core/src/cache/generic.ts index 19365e0e3f..7a2be5a0f0 100644 --- a/packages/backend-core/src/cache/generic.ts +++ b/packages/backend-core/src/cache/generic.ts @@ -18,9 +18,14 @@ export enum TTL { ONE_DAY = 86400, } -export const keys = GENERIC.keys -export const get = GENERIC.get -export const store = GENERIC.store -export const destroy = GENERIC.delete -export const withCache = GENERIC.withCache -export const bustCache = GENERIC.bustCache +function performExport(funcName: string) { + // @ts-ignore + return (...args: any) => GENERIC[funcName](...args) +} + +export const keys = performExport("keys") +export const get = performExport("get") +export const store = performExport("store") +export const destroy = performExport("delete") +export const withCache = performExport("withCache") +export const bustCache = performExport("bustCache") diff --git a/packages/backend-core/src/cache/invite.ts b/packages/backend-core/src/cache/invite.ts index 1fec52122e..e43ebc4aa8 100644 --- a/packages/backend-core/src/cache/invite.ts +++ b/packages/backend-core/src/cache/invite.ts @@ -4,7 +4,7 @@ import env from "../environment" import { getTenantId } from "../context" import * as redis from "../redis/init" -const TTL_SECONDS = Duration.fromDays(7).to(DurationType.SECONDS) +const TTL_SECONDS = Duration.fromDays(7).toSeconds() interface Invite { email: string diff --git a/packages/backend-core/src/cache/passwordReset.ts b/packages/backend-core/src/cache/passwordReset.ts index 9ee50c634c..7f5a93f149 100644 --- a/packages/backend-core/src/cache/passwordReset.ts +++ b/packages/backend-core/src/cache/passwordReset.ts @@ -2,7 +2,7 @@ import * as redis from "../redis/init" import * as utils from "../utils" import { Duration, DurationType } from "../utils" -const TTL_SECONDS = Duration.fromHours(1).to(DurationType.SECONDS) +const TTL_SECONDS = Duration.fromHours(1).toSeconds() interface PasswordReset { userId: string diff --git a/packages/backend-core/src/utils/Duration.ts b/packages/backend-core/src/utils/Duration.ts index f376c2f7c7..3c7ef23b11 100644 --- a/packages/backend-core/src/utils/Duration.ts +++ b/packages/backend-core/src/utils/Duration.ts @@ -28,6 +28,9 @@ export class Duration { toMs: () => { return Duration.convert(from, DurationType.MILLISECONDS, duration) }, + toSeconds: () => { + return Duration.convert(from, DurationType.SECONDS, duration) + }, } }