The cheapest query is the one you skip
Stop asking the database the same question over and over
Every time a client opens the app, it asks the API for the list of nearby walkers. That list changes maybe once an hour โ a walker updates their bio, adjusts a price, goes on vacation. But the API re-runs the same Postgres query on every single request, even when a thousand requests in a row would get back the exact same rows.
Cache-aside (also called lazy loading) fixes that without touching the database schema at all: check a fast key-value store (Redis) first. On a hit, return it โ no Postgres round trip. On a miss, run the real query, then write the result into Redis with a TTL (time-to-live, an expiry in seconds) before returning it. The next request within that TTL hits Redis instead.
The name comes from where the cache sits: beside the database, not in front of it like a proxy. Your application code is the one deciding when to read from it and when to fill it โ Redis itself has no idea a Postgres table even exists.