feat: 优化性能
This commit is contained in:
1 parent
40379326b5
commit
7086e336cb
12 files changed
+438
-67
No files matched your search
@@ -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;
|
||||
Reference in new issue
Block a user