mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-26 21:27:48 -05:00
Zod validated config for security and ease of getting started
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { CacheEntry } from "@epic-web/cachified";
|
||||
import { ServerConfig } from "~/config.server";
|
||||
import { LRUCache } from "~/modules/cache";
|
||||
|
||||
declare global {
|
||||
@@ -11,8 +12,7 @@ export const cache = (global.__lruCache = global.__lruCache
|
||||
? global.__lruCache
|
||||
: new LRUCache<string, CacheEntry<unknown>>({ max: 5000 }));
|
||||
|
||||
export const ttl = (ms: number) =>
|
||||
process.env.DISABLE_CACHE === "true" ? 0 : ms;
|
||||
export const ttl = (ms: number) => (ServerConfig.disableCache ? 0 : ms);
|
||||
|
||||
export function syncCached<T>(key: string, getFreshValue: () => T) {
|
||||
if (cache.has(key)) {
|
||||
|
||||
Reference in New Issue
Block a user