cache.ts 597 B

1234567891011121314151617181920212223242526272829303132
  1. export default class Cache {
  2. private static readonly prefix:string = 'catchadmin_'
  3. /**
  4. * set
  5. *
  6. * @param key
  7. * @param value
  8. */
  9. static set (key:string, value: any) : void {
  10. window.localStorage.setItem(Cache.prefix + key, value)
  11. }
  12. /**
  13. * get
  14. *
  15. * @param key
  16. * @returns
  17. */
  18. static get (key: string) : any {
  19. return window.localStorage.getItem(Cache.prefix + key)
  20. }
  21. /**
  22. * delete
  23. *
  24. * @param key
  25. * @returns
  26. */
  27. static del (key: string) : void {
  28. window.localStorage.removeItem(Cache.prefix + key)
  29. }
  30. }