diff --git a/lib/cache/cache_manager.js b/lib/cache/cache_manager.js index 84ac9519..24bf33ae 100644 --- a/lib/cache/cache_manager.js +++ b/lib/cache/cache_manager.js @@ -1,6 +1,6 @@ import BLOG from '@/blog.config' import { getCacheFromMemory, setCacheToMemory } from '@/lib/cache/memory_cache' -const enableCache = true && !BLOG.isProd // 生产环境禁用 +const enableCache = true // 生产环境禁用 /** * 为减少频繁接口请求,notion数据将被缓存 diff --git a/lib/cache/memory_cache.js b/lib/cache/memory_cache.js index d047b838..ce107e0c 100644 --- a/lib/cache/memory_cache.js +++ b/lib/cache/memory_cache.js @@ -5,5 +5,5 @@ export async function getCacheFromMemory (key, options) { } export async function setCacheToMemory (key, data) { - await cache.put(key, data, 30 * 60 * 1000) // 30 minutes + await cache.put(key, data, 60 * 1000) // 1 minutes } diff --git a/pages/article/[slug].js b/pages/article/[slug].js index 4686a74b..baff300c 100644 --- a/pages/article/[slug].js +++ b/pages/article/[slug].js @@ -31,7 +31,9 @@ const Slug = ({ post, blockMap, tags, prev, next, allPosts, recommendPosts, cate export async function getStaticPaths () { let posts = [] - posts = await getAllPosts({ from: 'slug - paths', includePage: true }) + if (BLOG.isProd) { + posts = await getAllPosts({ from: 'slug - paths', includePage: true }) + } return { paths: posts.map(row => `${BLOG.path}/article/${row.slug}`), fallback: true