ObjectCache can be used to cache objects as needed by any application in memory. These objects are NOT persisted to disk or any other storage medium, so they are only good for the lifetime of the application. Do not attempt to directly instantiate this class, instead use the static Instance property of the MJGlobal class to get the instance of the ObjectCache for your application within that instance of MJGlobal.

Constructors

Properties

Methods

Constructors

Properties

_entries: ObjectCacheEntry<any>[] = []

Methods

  • Add a new object to the cache. If the key already exists, an exception is thrown

    Type Parameters

    • T

    Parameters

    • key: string
    • object: T

    Returns void

  • Remove all entries from the object cache

    Returns void

  • Returns an object from the cache based on the key and only if it matches the type provided in the generic

    Type Parameters

    • T

    Parameters

    • key: string

    Returns T

  • Remove an object from the cache based on the key

    Parameters

    • key: string

    Returns void

  • Replace an existing object in the cache with a new one. If the key does not exist, the new object is added

    Type Parameters

    • T

    Parameters

    • key: string
    • object: T

    Returns void