Skip to content

Commit

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

* update test

* 2.16.1
  • Loading branch information
kbarbounakis authored Dec 9, 2024
1 parent 2bf9d23 commit e7ecb74
Show file tree
Hide file tree
Showing 9 changed files with 403 additions and 489 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 e7ecb74

Please sign in to comment.