Data object to store cached values with their keys used by MemoryCache.


The CacheEntry class allows you to create a data object that can be used to store cached values with their keys used by MemoryCache.


Creates a new instance of the cache entry and assigns its values.

public constructor(key: string, value: any, timeout: number)

  • key: string - a unique key to locate the value.
  • value: any - a value to be stored.
  • timeout: number - expiration timeout in milliseconds.

Instance methods


Gets the expiration timeout.

public getExpiration(): number

  • returns: number - the expiration timeout in milliseconds.


Gets the key to locate the cached value.

public getKey(): string

  • returns: string - the value key.


Gets the cached value.

public getValue(): any

  • returns: any - the value object.


Checks if this value has already expired.

public isExpired(): boolean

  • returns: boolean - true if the value has already expired and false otherwise.


Sets a new value and extends its expiration.

public setValue(value: any, timeout: number): void

  • value: any - a new cached value.
  • timeout: number - a expiration timeout in milliseconds.