mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 15:09:22 +00:00
17 lines
422 B
JavaScript
17 lines
422 B
JavaScript
import cache from 'memory-cache'
|
|
import BLOG from 'blog.config'
|
|
|
|
const cacheTime = BLOG.isProd ? 10 * 60 : 120 * 60 // 120 minutes for dev,10 minutes for prod
|
|
|
|
export async function getCacheFromMemory (key, options) {
|
|
return cache.get(key)
|
|
}
|
|
|
|
export async function setCacheToMemory (key, data) {
|
|
await cache.put(key, data, cacheTime * 1000)
|
|
}
|
|
|
|
export async function delCacheFromMemory (key) {
|
|
await cache.del(key)
|
|
}
|