Validation results cached with TTL
Why it matters
DNS MX lookups and external validation API calls have measurable latency — typically 50–500ms per call — and most providers impose rate limits (e.g., 100 calls/minute on free tiers). Without caching, every signup and every re-validation check triggers a live network round-trip for the same domain. At 1,000 signups/hour from domains like gmail.com or company.com, redundant lookups waste budget, add latency to the user-facing signup flow, and risk triggering rate-limit errors that silently degrade validation coverage when the lookup fails open.
Severity rationale
Low because missing caching adds latency and cost rather than corrupting data, but at scale the rate-limit failures can silently disable validation for popular domains.
Remediation
Cache MX and disposable-check results at the domain level using Redis with a TTL of at least 1 hour:
import { redis } from '@/lib/redis'
async function getCachedMxResult(domain: string): Promise<boolean | null> {
const cached = await redis.get(`mx:${domain}`)
return cached === null ? null : cached === '1'
}
async function setCachedMxResult(domain: string, valid: boolean): Promise<void> {
await redis.setex(`mx:${domain}`, 6 * 60 * 60, valid ? '1' : '0')
}
// In the ingest handler:
const domain = email.split('@')[1]
let valid = await getCachedMxResult(domain)
if (valid === null) {
valid = await hasValidMx(email)
await setCachedMxResult(domain, valid)
}
If Redis is not available, a DB table with an expires_at column works as a fallback. A TTL of 1–24 hours is standard — MX records change infrequently.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Data Quality & List Hygiene Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- iso-25010:2011 · performance-efficiency — Performance Efficiency
Taxons
History
- 2026-04-18·v1.0.0·Initial import from data-quality-list-hygiene·automated