Caching Query Results

Caching Query Results

If the same expensive question is asked of your database over and over, answering it fresh every time is wasteful. Caching stores the answer for a short while so repeated requests are served instantly.

Used well, caching dramatically improves speed and reduces database load; used carelessly, it can show people stale information.

What Gets Cached

Good candidates are results that are read often but change rarely — a homepage product list, a navigation menu, or a report that updates hourly. We keep these in a fast store such as Redis so they need not be recalculated each time.

Keeping the Cache Honest

  • Expiry: entries auto-clear after a set time.
  • Invalidation: we clear the cache when the underlying data changes.
  • Scope: we avoid caching anything personal or sensitive unless carefully keyed per user.

The Balance

Every cache is a deliberate trade between freshness and speed. We pick expiry times that match how tolerant each piece of content is to being a little out of date.

If you need a hand with any of this, your Progressive Robot delivery team is ready to help. Raise a ticket from the Support area of your client portal or speak to your account manager and we will guide you through the next steps.

Did you find this article useful?