I just attended and presented at ConFoo, where I always learn new things. This year, the best talk I attended was by our own Magnus Hagander. Called Integrated Cache Invalidation for Better Hit Rates, it addresses the difficult task of controlling web page cache refresh by providing a reliable mechanism for invalidating the cache when the database changes. It shows how to use triggers and pgq to communicate changes to a Varnish web frontend.
Caching in front of a database is often risky. However, with triggers, pgq, and Varnish, proper invalidation can be accomplished, dramatically increasing the scalability of database-backed websites.