/** * Update Deduplication * * Prevents processing duplicate Telegram updates. * Telegram may occasionally send the same update multiple times. */ export interface DedupeCacheOptions { /** Time-to-live in milliseconds */ ttlMs?: number; /** Maximum cache size */ maxSize?: number; } export declare class DedupeCache { private cache; private ttlMs; private maxSize; constructor(options?: DedupeCacheOptions); /** * Check if key exists and is not expired */ has(key: string): boolean; /** * Add key to cache */ add(key: string): void; /** * Check and add atomically - returns true if was already seen */ checkAndAdd(key: string): boolean; /** * Clean up expired entries */ private cleanup; /** * Clear all entries */ clear(): void; /** * Get cache stats */ getStats(): { size: number; maxSize: number; ttlMs: number; }; } /** * Build a unique key for a Telegram update */ export declare function buildTelegramUpdateKey(ctx: { update?: { update_id?: number; message?: { message_id?: number; chat?: { id?: number; }; }; }; callbackQuery?: { id?: string; }; }): string | undefined; export declare const telegramUpdateDedupe: DedupeCache;