mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-02 15:10:16 +00:00
feature:
缓存优化
This commit is contained in:
@@ -3,7 +3,8 @@ import { NotionAPI } from 'notion-client'
|
||||
import { getDataFromCache, setDataToCache } from '@/lib/cache/cache_manager'
|
||||
|
||||
export async function getPostBlocks (id, from) {
|
||||
let pageBlock = await getDataFromCache('page_block_' + id)
|
||||
const cacheKey = 'page_block_' + id
|
||||
let pageBlock = await getDataFromCache(cacheKey)
|
||||
if (pageBlock) {
|
||||
console.log('[请求缓存]:', `from:${from}`, `id:${id}`)
|
||||
return pageBlock
|
||||
@@ -20,7 +21,7 @@ export async function getPostBlocks (id, from) {
|
||||
}
|
||||
|
||||
if (pageBlock) {
|
||||
await setDataToCache('page_block_' + id, pageBlock)
|
||||
await setDataToCache(cacheKey, pageBlock)
|
||||
}
|
||||
return pageBlock
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user