Aside: do you still need to use a cache service when using Postgres? Our Django web app forgoes any caching because “Postgres is fast enough” and “has its own cache”.
Or you have some complex ranking/relationship/aggregation calculations - it might computationally be infeasible for the database, as hard as people worked on its efficiency, to calculate such a query on each request...
1. Needing a consistent (meaning reading off replicas is not fresh enough) data source for reads and writes that happens every request to very high-request site. Think sessions, api rate limiting.
2. Needing a fast store for denormalized data.
But if some query takes 5 minutes to run and you can’t speed it up, you need to do something.
I cache a very few select queries that don’t need to be 100% accurate as scan a ton of rows.