mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-09 15:10:39 +00:00
生产环境打包速度
This commit is contained in:
2
lib/cache/cache_manager.js
vendored
2
lib/cache/cache_manager.js
vendored
@@ -1,6 +1,6 @@
|
|||||||
import BLOG from '@/blog.config'
|
import BLOG from '@/blog.config'
|
||||||
import { getCacheFromMemory, setCacheToMemory } from '@/lib/cache/memory_cache'
|
import { getCacheFromMemory, setCacheToMemory } from '@/lib/cache/memory_cache'
|
||||||
const enableCache = true && !BLOG.isProd // 生产环境禁用
|
const enableCache = true // 生产环境禁用
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 为减少频繁接口请求,notion数据将被缓存
|
* 为减少频繁接口请求,notion数据将被缓存
|
||||||
|
|||||||
2
lib/cache/memory_cache.js
vendored
2
lib/cache/memory_cache.js
vendored
@@ -5,5 +5,5 @@ export async function getCacheFromMemory (key, options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function setCacheToMemory (key, data) {
|
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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,9 @@ const Slug = ({ post, blockMap, tags, prev, next, allPosts, recommendPosts, cate
|
|||||||
|
|
||||||
export async function getStaticPaths () {
|
export async function getStaticPaths () {
|
||||||
let posts = []
|
let posts = []
|
||||||
posts = await getAllPosts({ from: 'slug - paths', includePage: true })
|
if (BLOG.isProd) {
|
||||||
|
posts = await getAllPosts({ from: 'slug - paths', includePage: true })
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
paths: posts.map(row => `${BLOG.path}/article/${row.slug}`),
|
paths: posts.map(row => `${BLOG.path}/article/${row.slug}`),
|
||||||
fallback: true
|
fallback: true
|
||||||
|
|||||||
Reference in New Issue
Block a user