pgmemcache
If you can resolve the page invalidation problem in a more general way, it's possible to use memcached as an intermediary for database queries too. When a user on a web site is grabbing their own data over and over, but not modifying it, you should be able to figure out how to cache database lookups related to their data usefully. Then you just need to be careful to throw those pages out if the data is modified.
The way to do that in PostgreSQL is quite straightforward: simply add a pair of triggers for AFTER UPDATE ON
and AFTER DELETE ON
for any table you are storing in the cache. If you take care of that, you can use the pgmemcache program from http://pgfoundry.org/projects/pgmemcache/ in order to handle the routine chores of setting up memcached for storing database information.
Note
There is a second program with the confusingly similar name of pgmemcached that was a development effort related to PostgreSQL/memcached integration. This project was completed and abandoned...