Class: CacheEntry

CacheEntry

The cache entry is a typed container of cache data used to track the creation and expiration of cache entries.


new CacheEntry(value, ttl)

Initializes the cache entry.

Parameters:
Name Type Description
value *

The cache entry value.

ttl number

The time to live in milliseconds.

Members


_created :number

The timestamp of creation of this cache entry.

Type:
  • number

_ttl :number

The time to live in milliseconds. The cache entry is considered expired after this time.

Type:
  • number

_value :*

Cache entry value.

Type:
  • *

Methods


getValue()

Returns the entry value. If entry value is type of object returns clone of that object.

Returns:

The entry value.

Type
*

isExpired()

Returns true if this entry has expired.

Returns:

true if this entry has expired.

Type
boolean

serialize()

Exports this cache entry into a JSON-serializable object.

Returns:

This entry exported to a JSON-serializable object.

Type
Object