mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 15:09:22 +00:00
feature:
广告、缓存
This commit is contained in:
5
lib/cache/memory_cache.js
vendored
5
lib/cache/memory_cache.js
vendored
@@ -1,9 +1,12 @@
|
||||
import cache from 'memory-cache'
|
||||
import BLOG from 'blog.config'
|
||||
|
||||
const cacheTime = BLOG.isProd ? 60 : 60 * 60
|
||||
|
||||
export async function getCacheFromMemory (key, options) {
|
||||
return cache.get(key)
|
||||
}
|
||||
|
||||
export async function setCacheToMemory (key, data) {
|
||||
await cache.put(key, data, 60 * 1000) // 1 minutes
|
||||
await cache.put(key, data, cacheTime * 1000)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user