mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-16 15:09:28 +00:00
缓存优化
This commit is contained in:
11
lib/cache/cache_manager.js
vendored
11
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, delCacheFromMemory } from '@/lib/cache/memory_cache'
|
||||
// import { getCacheFromFile, setCacheToFile, delCacheFromFile } from './local_file_cache'
|
||||
const enableCache = true // 生产环境禁用
|
||||
|
||||
/**
|
||||
@@ -24,3 +24,10 @@ export async function setDataToCache (key, data) {
|
||||
}
|
||||
await setCacheToMemory(key, data)
|
||||
}
|
||||
|
||||
export async function delCacheData (key) {
|
||||
if (!enableCache) {
|
||||
return
|
||||
}
|
||||
await delCacheFromMemory(key)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user