mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
引入mongodb
This commit is contained in:
8
lib/cache/cache_manager.js
vendored
8
lib/cache/cache_manager.js
vendored
@@ -1,9 +1,13 @@
|
||||
import MemoryCache from './memory_cache'
|
||||
import FileCache from './local_file_cache'
|
||||
import MongoCache from './mongo_db_cache'
|
||||
const enableCache = true
|
||||
const enableMongoCache = true
|
||||
|
||||
let api
|
||||
if (process.env.ENABLE_FILE_CACHE) {
|
||||
if (enableMongoCache) {
|
||||
api = MongoCache
|
||||
} else if (process.env.ENABLE_FILE_CACHE) {
|
||||
api = FileCache
|
||||
} else {
|
||||
api = MemoryCache
|
||||
@@ -22,7 +26,7 @@ export async function getDataFromCache(key) {
|
||||
if (JSON.stringify(dataFromCache) === '[]') {
|
||||
return null
|
||||
}
|
||||
return dataFromCache
|
||||
return MongoCache.getCache(key)
|
||||
}
|
||||
|
||||
export async function setDataToCache(key, data) {
|
||||
|
||||
Reference in New Issue
Block a user