| | |
| | | import { accessSessionKey, getSessionKey, getUserNameKey, userNameKey } from './request'; |
| | | import { accessSessionKey, getSessionKey, getUserNameKey, userNameKey,domainPrefix } from './request'; |
| | | |
| | | /** |
| | | * window.localStorage 浏览器永久缓存 |
| | |
| | | // 查看 v2.4.3版本更新日志 |
| | | setKey(key: string) { |
| | | // @ts-ignore |
| | | return `${__NEXT_NAME__}:${key}`; |
| | | return `${__NEXT_NAME__}:${domainPrefix}${key}`; |
| | | }, |
| | | // 设置永久缓存 |
| | | set<T>(key: string, val: T, win = window) { |
| | |
| | | // 获取,过期则清除 |
| | | get(key: string) { |
| | | const cacheValue: CacheValue<any> = Local.get(key); |
| | | if(!cacheValue?.expiredTime) return null; |
| | | if (new Date().getTime() > cacheValue.expiredTime) { |
| | | Local.remove(key); |
| | | return null; |