apps/api: add seconds util
This commit is contained in:
parent
e0d2836f4a
commit
ab0d455afb
@ -1 +1,3 @@
|
||||
export const DEFAULT_CACHE_TTL = 15 * 60;
|
||||
import { seconds } from 'src/utils/time';
|
||||
|
||||
export const DEFAULT_CACHE_TTL = seconds().fromMinutes(15);
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
import { seconds } from 'src/utils/time';
|
||||
|
||||
export const queryTTL: Record<string, number | false> = {
|
||||
GetLeads: false,
|
||||
GetSystemUser: 6 * 60 * 60,
|
||||
GetSystemUser: seconds().fromHours(12),
|
||||
};
|
||||
|
||||
13
apps/api/src/utils/time.ts
Normal file
13
apps/api/src/utils/time.ts
Normal file
@ -0,0 +1,13 @@
|
||||
export function seconds() {
|
||||
return {
|
||||
fromDays(days: number) {
|
||||
return days * 24 * 60 * 60;
|
||||
},
|
||||
fromHours(hours: number) {
|
||||
return hours * 60 * 60;
|
||||
},
|
||||
fromMinutes(minutes: number) {
|
||||
return minutes * 60;
|
||||
},
|
||||
};
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user