Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
najiu-admin-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
najiu-frontend
najiu-admin-template
Commits
fedd9cae
Commit
fedd9cae
authored
Mar 23, 2021
by
Vben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip: cache miss
parent
5bf90eea
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
5 deletions
+8
-5
main.ts
src/main.ts
+4
-1
projectSetting.ts
src/settings/projectSetting.ts
+1
-1
index.ts
src/utils/auth/index.ts
+1
-1
memory.ts
src/utils/cache/memory.ts
+1
-1
persistent.ts
src/utils/cache/persistent.ts
+1
-1
No files found.
src/main.ts
View file @
fedd9cae
...
@@ -32,6 +32,9 @@ import { isDevMode } from '/@/utils/env';
...
@@ -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';
...
@@ -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
);
...
...
src/settings/projectSetting.ts
View file @
fedd9cae
...
@@ -23,7 +23,7 @@ const setting: ProjectConfig = {
...
@@ -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
,
...
...
src/utils/auth/index.ts
View file @
fedd9cae
...
@@ -17,5 +17,5 @@ export function getAuthCache<T>(key: BasicKeys) {
...
@@ -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
);
}
}
src/utils/cache/memory.ts
View file @
fedd9cae
...
@@ -59,7 +59,7 @@ export class Memory<T = any, V = any> {
...
@@ -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
;
...
...
src/utils/cache/persistent.ts
View file @
fedd9cae
...
@@ -69,7 +69,7 @@ export class Persistent {
...
@@ -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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment