Cache lookup
Every request checks Redis before executing the database search pipeline.
V5 wraps the complete indexed and typo-tolerant PostgreSQL search pipeline with Redis result caching. Cache hits bypass PostgreSQL entirely.
Run a query once to populate Redis, then run the exact same logical query again to observe a cache hit and PostgreSQL bypass.
Every request checks Redis before executing the database search pipeline.
Cache misses continue through FTS + GIN and fuzzy fallback when necessary.
Cached search results can be returned without touching PostgreSQL.
Something went wrong.
This is the defining V5 decision point: return cached results or execute the search engine.
Run a query to inspect Redis behavior.
Time spent checking Redis.
Cache population time on a miss.
Configured cache lifetime.
Remaining lifetime for a cached result.
Versioned SHA-256 cache namespace.
Cache hits should show PostgreSQL as completely bypassed.
Waiting for request.
Original algorithm that produced these results.
PostgreSQL retrieval engine used on the cache-generating request.
Whether trigram fuzzy recovery was necessary.
Available when PostgreSQL executes.
Redis returned the cached search result, so no SQL query or EXPLAIN ANALYZE was executed.
Waiting for execution plan.
Evolution from raw substring search to cache-backed multi-stage retrieval.
| Version | Architecture | Results | App time | DB executed | Cache | Main improvement |
|---|---|---|---|---|---|---|
| V1 | ILIKE | — | — | Yes | None | Substring matching |
| V2 | Runtime FTS | — | — | Yes | None | Linguistic retrieval |
| V3 | FTS + GIN | — | — | Yes | None | Indexed retrieval |
| V4 | FTS + fuzzy | — | — | Yes | None | Typo recovery |
| V5 | Redis + V4 pipeline | — | — | — | — | Result reuse |
Results from the active search path.
Redis is checked before PostgreSQL. On a miss, the database result is stored for future requests.
GET → MISS → DB → SET
A cache hit returns the final result without executing FTS, fuzzy search or EXPLAIN.
database.executed = false
Cached results expire automatically so stale search responses do not persist indefinitely.
ex = 300
Redis is an optimization. If it fails, PostgreSQL remains the source of truth.
RedisError → PostgreSQL
Redis cannot improve relevance, fix poor fuzzy scoring or repair bad SQL. It only makes previously computed results cheaper to retrieve.
Linguistic retrieval.
Efficient candidate lookup.
Handle imperfect queries.
Avoid repeated computation.