mirror of
https://github.com/ourongxing/newsnow.git
synced 2025-02-07 22:10:03 +08:00
12 lines
287 B
TypeScript
12 lines
287 B
TypeScript
import process from "node:process"
|
|
import { Cache } from "#/database/cache"
|
|
|
|
export function useCache() {
|
|
try {
|
|
const db = useDatabase()
|
|
if (db && process.env.NODE_ENV === "production") return new Cache(db)
|
|
} catch (e) {
|
|
logger.error("failed to init database ", e)
|
|
}
|
|
}
|