///
import { Writable } from "stream";
export interface IStreamCache extends Iterable> {
expire(key: K): Promise;
get(req: R): Promise;
}
export interface IStreamCacheOptions {
keyExtractor: KeyExtractor;
streamExtractor: StreamExtractor;
cacheBackend: IStreamCacheBackend;
producer: StreamProducer;
}
export interface ICacheItem {
readonly key: K;
readonly lastAccess: Date;
readonly size: number;
}
export declare type StreamProducer = (req: R, stream: Writable) => void;
export declare type KeyExtractor = (req: R) => K;
export declare type StreamExtractor = (req: R) => Writable;
export interface IStreamCacheBackend extends Iterable> {
putStreaming(key: K): Promise;
getSteaming(key: K, output: Writable): Promise;
expunge(key: K): Promise;
}
export declare function cache(options: IStreamCacheOptions): IStreamCache;