-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdata-cache.d.ts
More file actions
35 lines (27 loc) · 1.45 KB
/
data-cache.d.ts
File metadata and controls
35 lines (27 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// MOST Web Framework 2.0 Codename Blueshift BSD-3-Clause license Copyright (c) 2017-2022, THEMOST LP All rights reserved
import {ConfigurationStrategy} from "@themost/common";
export declare interface DataCacheStrategyBase {
add(key: string, value: any, absoluteExpiration?: number): Promise<any>;
remove(key: string): Promise<any>;
clear(): Promise<void>;
get<T>(key: string): Promise<T>;
getOrDefault<T>(key: string, getFunc: () => Promise<T>, absoluteExpiration?: number): Promise<T>;
}
export declare interface DataCacheFinalize extends DataCacheStrategyBase {
finalize(): Promise<void>;
}
export declare abstract class DataCacheStrategy extends ConfigurationStrategy implements DataCacheStrategyBase {
abstract add(key: string, value: any, absoluteExpiration?: number): Promise<any>;
abstract remove(key: string): Promise<any>;
abstract clear(): Promise<void>;
abstract get<T>(key: string): Promise<T>;
abstract getOrDefault<T>(key: string, getFunc: () => Promise<T>, absoluteExpiration?: number): Promise<T>;
}
export declare class DefaultDataCacheStrategy extends DataCacheStrategy implements DataCacheFinalize {
add(key: string, value: any, absoluteExpiration?: number): Promise<any>;
remove(key: string): Promise<any>;
clear(): Promise<void>;
get<T>(key: string): Promise<T>;
getOrDefault<T>(key: string, getFunc: () => Promise<T>, absoluteExpiration?: number): Promise<T>;
finalize(): Promise<void>;
}