UNPKG

@push.rocks/webrequest

Version:

Modern, fetch-compatible web request library with intelligent HTTP caching, retry strategies, and fault tolerance.

45 lines (44 loc) 1.2 kB
/** * Cache manager - orchestrates caching logic */ import type { ICacheOptions } from '../webrequest.types.js'; import { CacheStore } from './cache.store.js'; import { type IStrategyResult } from './cache.strategies.js'; export declare class CacheManager { private cacheStore; constructor(dbName?: string, storeName?: string); /** * Execute a request with caching */ execute(request: Request, options: ICacheOptions & { logging?: boolean; }, fetchFn: (request: Request) => Promise<Response>): Promise<IStrategyResult>; /** * Determine the caching strategy based on options and request */ private determineStrategy; /** * Map standard fetch cache modes to our strategies */ private mapCacheModeToStrategy; /** * Generate cache key */ private generateCacheKey; /** * Clear the cache */ clear(): Promise<void>; /** * Delete a specific cache entry */ delete(cacheKey: string): Promise<void>; /** * Check if a cache entry exists */ has(cacheKey: string): Promise<boolean>; /** * Get the underlying cache store */ getStore(): CacheStore; }