DashBoard组件相关

This commit is contained in:
tangly1024.com
2024-11-21 11:24:32 +08:00
parent 762c9e9440
commit d2f97f7e6b
5 changed files with 55 additions and 24 deletions

View File

@@ -10,10 +10,11 @@ import MemoryCache from './memory_cache'
export async function getDataFromCache(key, force) {
if (BLOG.ENABLE_CACHE || force) {
const dataFromCache = await getApi().getCache(key)
if (JSON.stringify(dataFromCache) === '[]') {
if (!dataFromCache || JSON.stringify(dataFromCache) === '[]') {
return null
}
return getApi().getCache(key)
// console.trace('[API-->>缓存]:', key, dataFromCache)
return dataFromCache
} else {
return null
}
@@ -23,6 +24,7 @@ export async function setDataToCache(key, data) {
if (!data) {
return
}
// console.trace('[API-->>缓存写入]:', key)
await getApi().setCache(key, data)
}