feat: 优化性能

This commit is contained in:
539943419 committed 2025-01-13 01:49:55 +08:00
1 parent 40379326b5
commit 7086e336cb
12 files changed
+438 -67

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
import { defineStore } from "pinia";
export const useDefaultStore = defineStore("default", () => {
const cache = ref<Map<string, any>>(new Map());
const setCache = (key: string, value: any, option?: {}) => {
cache.value.set(key, { value });
};
const getCache = (key: string) => {
return cache.value.get(key)?.value ?? undefined;
};
const deleteCache = (key: string) => {
cache.value.delete(key);
};
return { cache, setCache, getCache, deleteCache };
});
export default useDefaultStore;