Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Cache

A Singleton Class that wraps localStorage calls to simply setting and retrieving non-String values. All values stored will be Stringified and all values returned will be parsed back with JSON.parse

Hierarchy

  • Cache

Index

Accessors

Methods

Accessors

Static storage

  • set storage(value: Storage): void
  • Will change the the Storage type used by the Cache. This can be any class that implements the Storage iterface. ie. LocalStorage,SessionStorage,Storage

    Parameters

    • value: Storage

    Returns void

Methods

Static get

  • get(key: string): any
  • Retrieves value from the cache stored with the key

    Parameters

    • key: string

      The key used to identify the cached value

    Returns any

    value - the value cached

Static has

  • has(key: string): boolean
  • Checks if a key is in the cache

    Parameters

    • key: string

      The key used to identify the cached value

    Returns boolean

    value - if the cache contains the key

Static list

  • list(): void

Static put

  • put(key: string, value: any): any
  • Adds value to cache with the key as the identifier

    Parameters

    • key: string

      The key used to store the cached value

    • value: any

      The value to be cached

    Returns any

    value - the value stored

Static remove

  • remove(key: string): void
  • Removes a key from the cache

    Parameters

    • key: string

      The key used to identify the cached value

    Returns void

Generated using TypeDoc