Skip to main content
Dotset CLI API Documentation / index / TieredCache

Class: TieredCache<K, V>

Defined in: src/mantle/utils/cache.ts:568 Multi-tier cache with L1 (fast/small) and L2 (slower/larger) layers

Type Parameters

K

K

V

V

Constructors

Constructor

new TieredCache<K, V>(l1Options, l2Options): TieredCache<K, V>;
Defined in: src/mantle/utils/cache.ts:572

Parameters

l1Options
LRUCacheOptions = ...
l2Options
LRUCacheOptions = ...

Returns

TieredCache<K, V>

Methods

clear()

clear(): void;
Defined in: src/mantle/utils/cache.ts:614

Returns

void

delete()

delete(key): boolean;
Defined in: src/mantle/utils/cache.ts:608

Parameters

key
K

Returns

boolean

get()

get(key): V | undefined;
Defined in: src/mantle/utils/cache.ts:580

Parameters

key
K

Returns

V | undefined

getMetrics()

getMetrics(): {
  l1: CacheMetrics;
  l2: CacheMetrics;
};
Defined in: src/mantle/utils/cache.ts:619

Returns

{
  l1: CacheMetrics;
  l2: CacheMetrics;
}
l1
l1: CacheMetrics;
l2
l2: CacheMetrics;

has()

has(key): boolean;
Defined in: src/mantle/utils/cache.ts:604

Parameters

key
K

Returns

boolean

set()

set(
   key, 
   value, 
   ttl?): void;
Defined in: src/mantle/utils/cache.ts:598

Parameters

key
K
value
V
ttl?
number

Returns

void