mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
build
This commit is contained in:
8
lib/cache/cache_manager.js
vendored
8
lib/cache/cache_manager.js
vendored
@@ -1,5 +1,5 @@
|
||||
// import { getCacheFromMemory, setCacheToMemory } from '@/lib/cache/memory_cache'
|
||||
import { getCacheFromFile, setCacheToFile } from './local_file_cache'
|
||||
import { getCacheFromMemory, setCacheToMemory } from '@/lib/cache/memory_cache'
|
||||
// import { getCacheFromFile, setCacheToFile } from './local_file_cache'
|
||||
const enableCache = true // 生产环境禁用
|
||||
|
||||
/**
|
||||
@@ -11,7 +11,7 @@ export async function getDataFromCache (key) {
|
||||
if (!enableCache) {
|
||||
return null
|
||||
}
|
||||
const dataFromCache = await getCacheFromFile(key)
|
||||
const dataFromCache = await getCacheFromMemory(key)
|
||||
if (JSON.stringify(dataFromCache) === '[]') {
|
||||
return null
|
||||
}
|
||||
@@ -22,5 +22,5 @@ export async function setDataToCache (key, data) {
|
||||
if (!enableCache || !data) {
|
||||
return
|
||||
}
|
||||
await setCacheToFile(key, data)
|
||||
await setCacheToMemory(key, data)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user