Skip to main content

Class: CacheEntry<V>

@ima/core.CacheEntry

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

Type parameters

Name
V

Constructors

constructor

new CacheEntry<V>(value, ttl)

Initializes the cache entry.

Type parameters

Name
V

Parameters

NameTypeDescription
valueVThe cache entry value.
ttlstring | numberThe time to live in milliseconds.

Defined in

packages/core/src/cache/CacheEntry.ts:33

Properties

_created

Protected _created: number

The timestamp of creation of this cache entry.

Defined in

packages/core/src/cache/CacheEntry.ts:25


_ttl

Protected _ttl: string | number

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

Defined in

packages/core/src/cache/CacheEntry.ts:20


_value

Protected _value: V

Cache entry value.

Defined in

packages/core/src/cache/CacheEntry.ts:14

Methods

getValue

getValue(): V

Returns the entry value.

Returns

V

Defined in

packages/core/src/cache/CacheEntry.ts:61


isExpired

isExpired(): boolean

Returns true if this entry has expired.

Returns

boolean

true if this entry has expired.

Defined in

packages/core/src/cache/CacheEntry.ts:43


serialize

serialize(): SerializedCacheEntry<V>

Exports this cache entry into a JSON-serializable object.

This entry exported to a JSON-serializable object.

Returns

SerializedCacheEntry<V>

Defined in

packages/core/src/cache/CacheEntry.ts:54