import Redis from 'ioredis';
export declare function getRedis(): Redis;
export interface CacheMatch {
    id: string;
    responsePayload: string;
    responseTokens: number | null;
    matchType: 'exact' | 'fuzzy';
    similarityScore: number;
    cacheKey: string;
}
/**
 * Stage 1: Exact match via Redis hash lookup
 */
export declare function exactMatch(agent: string, cacheKey: string): Promise<CacheMatch | null>;
/**
 * Stage 2: Fuzzy match via pg_trgm in PostgreSQL
 * Includes numeric flip guard to prevent matching queries where
 * key numbers (spreads, totals, odds) differ.
 * Scoped by category + data_version to prevent cross-category and stale matches.
 */
export declare function fuzzyMatch(agent: string, normalizedQuery: string, category?: string, dataVersion?: string | null): Promise<CacheMatch | null>;
/**
 * Combined lookup: tries exact first, then fuzzy.
 * Category + dataVersion scope the fuzzy search to prevent
 * cross-category pollution and stale-data matches.
 */
export declare function findMatch(agent: string, cacheKey: string, normalizedQuery: string, category?: string, dataVersion?: string | null): Promise<CacheMatch | null>;
/**
 * Store a cache entry in both Redis and PostgreSQL
 */
export declare function storeEntry(params: {
    cacheKey: string;
    normalizedQuery: string;
    originalQuery: string;
    agent: string;
    category: string;
    responsePayload: string;
    responseTokens: number | null;
    league: string | null;
    teams: string[];
    gameDate: string | null;
    ttlSeconds: number;
    modelUsed: string | null;
    tokensIn: number | null;
    tokensOut: number | null;
    source: 'live' | 'warm';
    dataVersion?: string | null;
    gameState?: string | null;
}): Promise<string | null>;
/**
 * Record a cache hit (update hit_count + last_hit_at)
 */
export declare function recordHit(entryId: string): Promise<void>;
/**
 * Check dedup lock to prevent thundering herd
 */
export declare function acquireDedup(agent: string, cacheKey: string): Promise<boolean>;
/**
 * Release dedup lock
 */
export declare function releaseDedup(agent: string, cacheKey: string): Promise<void>;
/**
 * Clean up Redis connection on shutdown
 */
export declare function closeRedis(): Promise<void>;
//# sourceMappingURL=similarity.d.ts.map