import { HealthCheck } from '@platform-modules/util/health';
import { CacheBackend } from './index.js';

interface CacheHealthOptions {
    /** Name surfaced in the `HealthResult` (default `'cache'`). */
    name?: string;
    /** Probe key written then deleted (default `'__health_probe__'`). */
    key?: string;
    /**
     * Probe-key TTL in whole seconds (default 30). Bounds the key so a failed
     * `del` cleanup self-expires rather than leaving a dangling key.
     */
    ttlSeconds?: number;
}
/**
 * A set→get→del probe over any `CacheBackend`.
 *
 * Returns a `HealthCheck` whose `check()` NEVER throws — a backend failure becomes
 * `status:'down'` with a GENERIC `detail` (the raw error is swallowed; it can leak
 * connection/host detail — info-disclosure hard floor). A silent write-drop (read
 * back a value that does not match what was set) reports `status:'degraded'`.
 *
 * The probe key is written with a short TTL so a failed `del` self-expires.
 */
declare function healthCheck(backend: CacheBackend, opts?: CacheHealthOptions): HealthCheck;

export { type CacheHealthOptions, healthCheck };
