广告、缓存
This commit is contained in:
tangly1024
2021-12-17 21:21:44 +08:00
parent 58f4fff45f
commit f6f0e9d41a
3 changed files with 15 additions and 13 deletions

View File

@@ -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)
}