mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-26 08:36:19 +08:00
wip: cache miss
This commit is contained in:
@@ -32,6 +32,9 @@ import { isDevMode } from '/@/utils/env';
|
|||||||
// Register global components
|
// Register global components
|
||||||
registerGlobComp(app);
|
registerGlobComp(app);
|
||||||
|
|
||||||
|
// Multilingual configuration
|
||||||
|
await setupI18n(app);
|
||||||
|
|
||||||
// Configure routing
|
// Configure routing
|
||||||
setupRouter(app);
|
setupRouter(app);
|
||||||
|
|
||||||
@@ -45,7 +48,7 @@ import { isDevMode } from '/@/utils/env';
|
|||||||
setupErrorHandle(app);
|
setupErrorHandle(app);
|
||||||
|
|
||||||
// Mount when the route is ready
|
// Mount when the route is ready
|
||||||
await Promise.all([setupI18n(app), router.isReady()]);
|
await router.isReady();
|
||||||
|
|
||||||
app.mount('#app', true);
|
app.mount('#app', true);
|
||||||
|
|
||||||
|
@@ -23,7 +23,7 @@ const setting: ProjectConfig = {
|
|||||||
permissionMode: PermissionModeEnum.ROLE,
|
permissionMode: PermissionModeEnum.ROLE,
|
||||||
|
|
||||||
// Permission-related cache is stored in sessionStorage or localStorage
|
// Permission-related cache is stored in sessionStorage or localStorage
|
||||||
permissionCacheType: CacheTypeEnum.SESSION,
|
permissionCacheType: CacheTypeEnum.LOCAL,
|
||||||
|
|
||||||
// color
|
// color
|
||||||
themeColor: primaryColor,
|
themeColor: primaryColor,
|
||||||
|
@@ -17,5 +17,5 @@ export function getAuthCache<T>(key: BasicKeys) {
|
|||||||
|
|
||||||
export function setAuthCache(key: BasicKeys, value) {
|
export function setAuthCache(key: BasicKeys, value) {
|
||||||
const fn = isLocal ? Persistent.setLocal : Persistent.setSession;
|
const fn = isLocal ? Persistent.setLocal : Persistent.setSession;
|
||||||
return fn(key, value);
|
return fn(key, value, true);
|
||||||
}
|
}
|
||||||
|
2
src/utils/cache/memory.ts
vendored
2
src/utils/cache/memory.ts
vendored
@@ -59,7 +59,7 @@ export class Memory<T = any, V = any> {
|
|||||||
}
|
}
|
||||||
item.time = new Date().getTime() + this.alive;
|
item.time = new Date().getTime() + this.alive;
|
||||||
item.timeoutId = setTimeout(() => {
|
item.timeoutId = setTimeout(() => {
|
||||||
this.remove(key);
|
// this.remove(key);
|
||||||
}, expires);
|
}, expires);
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
|
2
src/utils/cache/persistent.ts
vendored
2
src/utils/cache/persistent.ts
vendored
@@ -69,7 +69,7 @@ export class Persistent {
|
|||||||
|
|
||||||
static setSession(key: SessionKeys, value: SessionStore[SessionKeys], immediate = false): void {
|
static setSession(key: SessionKeys, value: SessionStore[SessionKeys], immediate = false): void {
|
||||||
sessionMemory.set(key, toRaw(value));
|
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 {
|
static removeSession(key: SessionKeys): void {
|
||||||
|
Reference in New Issue
Block a user