Vben
2021-03-23 fedd9caefbffd8689c94ca5c6a3a6c7bd90de197
wip: cache miss
5个文件已修改
13 ■■■■■ 已修改文件
src/main.ts 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/settings/projectSetting.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/auth/index.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/cache/memory.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/cache/persistent.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.ts
@@ -32,6 +32,9 @@
  // Register global components
  registerGlobComp(app);
  // Multilingual configuration
  await setupI18n(app);
  // Configure routing
  setupRouter(app);
@@ -45,7 +48,7 @@
  setupErrorHandle(app);
  // Mount when the route is ready
  await Promise.all([setupI18n(app), router.isReady()]);
  await router.isReady();
  app.mount('#app', true);
src/settings/projectSetting.ts
@@ -23,7 +23,7 @@
  permissionMode: PermissionModeEnum.ROLE,
  // Permission-related cache is stored in sessionStorage or localStorage
  permissionCacheType: CacheTypeEnum.SESSION,
  permissionCacheType: CacheTypeEnum.LOCAL,
  // color
  themeColor: primaryColor,
src/utils/auth/index.ts
@@ -17,5 +17,5 @@
export function setAuthCache(key: BasicKeys, value) {
  const fn = isLocal ? Persistent.setLocal : Persistent.setSession;
  return fn(key, value);
  return fn(key, value, true);
}
src/utils/cache/memory.ts
@@ -59,7 +59,7 @@
    }
    item.time = new Date().getTime() + this.alive;
    item.timeoutId = setTimeout(() => {
      this.remove(key);
      // this.remove(key);
    }, expires);
    return value;
src/utils/cache/persistent.ts
@@ -69,7 +69,7 @@
  static setSession(key: SessionKeys, value: SessionStore[SessionKeys], immediate = false): void {
    sessionMemory.set(key, toRaw(value));
    immediate && ss.set(APP_SESSION_CACHE_KEY, sessionMemory);
    immediate && ss.set(APP_SESSION_CACHE_KEY, sessionMemory.getCache);
  }
  static removeSession(key: SessionKeys): void {