2022-12-05 23:01:12 +08:00

33 lines
597 B
TypeScript

export default class Cache {
private static readonly prefix:string = 'catchadmin_'
/**
* set
*
* @param key
* @param value
*/
static set (key:string, value: any) : void {
window.localStorage.setItem(Cache.prefix + key, value)
}
/**
* get
*
* @param key
* @returns
*/
static get (key: string) : any {
return window.localStorage.getItem(Cache.prefix + key)
}
/**
* delete
*
* @param key
* @returns
*/
static del (key: string) : void {
window.localStorage.removeItem(Cache.prefix + key)
}
}