/**
 * In-Memory Segment Cache Store
 *
 * Simple in-memory implementation of SegmentCacheStore.
 * Uses globalThis to survive HMR in development.
 */
import type { SegmentCacheStore, CachedEntryData, CacheDefaults, CacheGetResult } from "./types.js";
import type { RequestContext } from "../server/request-context.js";
/**
 * Options for MemorySegmentCacheStore
 */
export interface MemorySegmentCacheStoreOptions<TEnv = unknown> {
    /**
     * Optional name for this store instance. Named stores persist their
     * backing Map on globalThis so data survives Vite HMR module reloads.
     * Stores with different names get separate Maps.
     *
     * When omitted, the store uses a plain instance-level Map with no
     * globalThis sharing, which is the safest default for isolation.
     *
     * @example
     * ```typescript
     * // Two named stores are isolated from each other
     * const fast = new MemorySegmentCacheStore({ name: "fast", defaults: { ttl: 10 } });
     * const slow = new MemorySegmentCacheStore({ name: "slow", defaults: { ttl: 300 } });
     * ```
     */
    name?: string;
    /**
     * Default cache options for cache() boundaries.
     * When cache() is called without explicit ttl/swr,
     * these defaults are used.
     *
     * @example
     * ```typescript
     * const store = new MemorySegmentCacheStore({
     *   defaults: { ttl: 60, swr: 300 }
     * });
     * ```
     */
    defaults?: CacheDefaults;
    /**
     * Custom key generator applied to all cache operations.
     * Receives the full RequestContext and the default-generated key.
     *
     * @example
     * ```typescript
     * keyGenerator: (ctx, defaultKey) => {
     *   const locale = ctx.cookie('locale') || 'en';
     *   return `${locale}:${defaultKey}`;
     * }
     * ```
     */
    keyGenerator?: (ctx: RequestContext<TEnv>, defaultKey: string) => string | Promise<string>;
}
/**
 * In-memory segment cache store.
 *
 * Suitable for development and single-instance deployments.
 * For production with multiple instances, use a distributed store
 * like Cloudflare KV or Redis.
 *
 * @example
 * ```typescript
 * // Basic usage
 * const store = new MemorySegmentCacheStore();
 *
 * // With defaults for cache() boundaries
 * const store = new MemorySegmentCacheStore({
 *   defaults: { ttl: 60 }
 * });
 *
 * createRSCHandler({
 *   router,
 *   cache: { store }
 * })
 * ```
 */
export declare class MemorySegmentCacheStore<TEnv = unknown> implements SegmentCacheStore<TEnv> {
    private cache;
    readonly defaults?: CacheDefaults;
    readonly keyGenerator?: (ctx: RequestContext<TEnv>, defaultKey: string) => string | Promise<string>;
    constructor(options?: MemorySegmentCacheStoreOptions<TEnv>);
    get(key: string): Promise<CacheGetResult | null>;
    set(key: string, data: CachedEntryData, ttl: number, _swr?: number): Promise<void>;
    delete(key: string): Promise<boolean>;
    clear(): Promise<void>;
    /**
     * Get cache statistics for debugging purposes.
     * @internal
     */
    getStats(): {
        size: number;
        keys: string[];
    };
    /**
     * Reset the global cache registry.
     * Useful for test isolation - call this in beforeEach to ensure
     * tests don't share cache state via globalThis.
     *
     * @example
     * ```typescript
     * beforeEach(() => {
     *   MemorySegmentCacheStore.resetGlobalCache();
     * });
     * ```
     */
    static resetGlobalCache(): void;
}
//# sourceMappingURL=memory-segment-store.d.ts.map