@j03fr0st/pubg-ts
Version:
A comprehensive TypeScript wrapper for the PUBG API
38 lines • 1.02 kB
TypeScript
export interface CacheEntry<T> {
data: T;
timestamp: number;
ttl: number;
}
export interface CacheOptions {
ttl?: number;
maxSize?: number;
}
export declare class MemoryCache {
private cache;
private defaultTtl;
private maxSize;
private hits;
private misses;
constructor(options?: CacheOptions);
set<T>(key: string, data: T, ttl?: number): void;
get<T>(key: string): T | undefined;
has(key: string): boolean;
delete(key: string): boolean;
clear(): void;
cleanup(): void;
getStats(): {
size: number;
maxSize: number;
defaultTtl: number;
hits: number;
misses: number;
hitRate: number;
};
warm<T>(warmingEntries: Array<{
key: string;
value: () => Promise<T>;
}>, ttl?: number): Promise<void>;
}
export declare const globalCache: MemoryCache;
export declare const createCacheKey: (prefix: string, ...parts: (string | number)[]) => string;
//# sourceMappingURL=cache.d.ts.map