Skip to main content

Class: CacheEntry<V>

Defined in: packages/core/src/cache/CacheEntry.ts:10

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

Type Parameters

V

Constructors

new CacheEntry()

new CacheEntry<V>(value, ttl): CacheEntry<V>

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

Initializes the cache entry.

Parameters

value

V

The cache entry value.

ttl

The time to live in milliseconds.

string | number

Returns

CacheEntry<V>

Properties

_created

protected _created: number

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

The timestamp of creation of this cache entry.


_ttl

protected _ttl: string | number

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

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


_value

protected _value: V

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

Cache entry value.

Methods

getValue()

getValue(): V

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

Returns the entry value.

Returns

V


isExpired()

isExpired(): boolean

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

Returns true if this entry has expired.

Returns

boolean

true if this entry has expired.


serialize()

serialize(): SerializedCacheEntry<V>

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

Exports this cache entry into a JSON-serializable object.

This entry exported to a JSON-serializable object.

Returns

SerializedCacheEntry<V>