mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-21 15:09:43 +00:00
优化控制面板
This commit is contained in:
10
lib/cache/local_file_cache.js
vendored
10
lib/cache/local_file_cache.js
vendored
@@ -41,7 +41,7 @@ export async function setCache (key, data) {
|
||||
fs.writeFileSync(jsonFile, JSON.stringify(json))
|
||||
}
|
||||
|
||||
export async function delCache (key, data) {
|
||||
export async function delCache (key) {
|
||||
const exist = await fs.existsSync(jsonFile)
|
||||
const json = exist ? JSON.parse(await fs.readFileSync(jsonFile)) : {}
|
||||
delete json.key
|
||||
@@ -49,4 +49,12 @@ export async function delCache (key, data) {
|
||||
fs.writeFileSync(jsonFile, JSON.stringify(json))
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理缓存
|
||||
*/
|
||||
export async function cleanCache() {
|
||||
const json = {}
|
||||
fs.writeFileSync(jsonFile, JSON.stringify(json))
|
||||
}
|
||||
|
||||
export default { getCache, setCache, delCache }
|
||||
|
||||
Reference in New Issue
Block a user