| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- import {
- useUserCache
- } from "@/utils/userCache.js"
- // 身份确认缓存
- const identificationKey = 'ShenFenQueRen'
- export function useIdentificationTools() {
- const {saveCache,getCache,removeCache} = useUserCache();
-
- function saveIdentCache(key,data) {
- saveCache(identificationKey,key, data)
- }
- function getIdentCache(key) {
- return getCache(identificationKey, key)
- }
- function removeIdentCache(key) {
- removeCache(identificationKey,key)
- }
- return {
- saveIdentCache,
- getIdentCache,
- removeIdentCache
- }
- }
- const ksCache = 'kaoshiCache'
- export function useKaoShiCache() {
- const {saveCache,getCache,removeCache,getCacheOtherNotKey} = useUserCache();
-
- function saveCacheKs(key,data) {
- saveCache(ksCache,key, data)
- }
-
- function getCacheKs(key) {
- return getCache(ksCache, key)
- }
-
- function removeCacheKs(key) {
- removeCache(ksCache,key)
- }
-
-
- // 清理考试缓存其他,保留目标缓存 务必使考试缓存保持唯一
- function removeCacheKsOther(key) {
- const data = getCacheOtherNotKey(ksCache)
- if (data) {
- const newData = data[key];
- saveCache(ksCache, key, newData)
- }
- }
-
-
- return {
- saveCacheKs,
- getCacheKs,
- removeCacheKs,
- removeCacheKsOther
- }
- }
|