Skip to content

Commit

Permalink
bump node-cache to 5.1.2 (#178)
Browse files Browse the repository at this point in the history
* bump node-cache to 5.1.2

* 2.6.63
  • Loading branch information
kbarbounakis authored Nov 29, 2024
1 parent a5d83f2 commit f1798b7
Show file tree
Hide file tree
Showing 5 changed files with 338 additions and 470 deletions.
35 changes: 9 additions & 26 deletions data-cache.d.ts
Original file line number Diff line number Diff line change
@@ -1,52 +1,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<any>;
get(key: string): Promise<any>;
getOrDefault(key: string, getFunc: Promise<any>, absoluteExpiration?: number): 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 class DataCache {
init(callback: (err?: Error) => void): void;

remove(key: string, callback: (err?: Error) => void): void;

removeAll(callback: (err?: Error) => void): void;

add(key: string, value: any, ttl?: number, callback?: (err?: Error) => void): void;

ensure(key: string, getFunc: (err?: Error, res?: any) => void, callback?: (err?: Error) => void): void;

get(key: string, callback?: (err?: Error, res?: any) => void): void;

static getCurrent(): DataCache;
}

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<any>;
abstract get(key: string): Promise<any>;
abstract getOrDefault(key: string, getFunc: Promise<any>, absoluteExpiration?: number): 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<any>;
get(key: string): Promise<any>;
getOrDefault(key: string, getFunc: Promise<any>, absoluteExpiration?: number): 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>;

}
Loading

0 comments on commit f1798b7

Please sign in to comment.