Merged in feat/common-package (pull request #2333)
feat: Add common package * Add isEdge, safeTry and dataCache to new common package * Add eslint and move prettier config * Fix yarn lock * Clean up tests * Add lint-staged config to common * Add missing dependencies Approved-by: Joakim Jäderberg
This commit is contained in:
18
packages/common/dataCache/DistributedCache/client.ts
Normal file
18
packages/common/dataCache/DistributedCache/client.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { env } from "../../env/server"
|
||||
import { cacheOrGet } from "./cacheOrGet"
|
||||
import { deleteKey } from "./deleteKey"
|
||||
import { get } from "./get"
|
||||
import { set } from "./set"
|
||||
|
||||
import type { DataCache } from "../Cache"
|
||||
|
||||
export const API_KEY = env.REDIS_API_KEY ?? ""
|
||||
export async function createDistributedCache(): Promise<DataCache> {
|
||||
return {
|
||||
type: "redis",
|
||||
get,
|
||||
set,
|
||||
cacheOrGet,
|
||||
deleteKey,
|
||||
} satisfies DataCache
|
||||
}
|
||||
Reference in New Issue
Block a user