update strategy

Ivan Krstic krstic at fas.harvard.edu
Sat Oct 8 03:55:44 PDT 2005


mrot wrote:
> Therefore when some client updates database additionally converts UPDATE
> into SELECT
> and using SELECT... key updates the cache.
> It is not perfect but may work.

It's generally redundant to SELECT data you just UPDATEed. At the point
in your code where you're running the UPDATE, simply replace the value
in the cache with the new one.

If you're caching whole rows, and you ran a partial update so you don't
have the entire new row, simply dirty the cache page and let the row get
cached lazily the next time it's accessed.

> I don't suppose that anybody who uses memcached has PostgreSQL :)

Why would choice of database have *anything* at all to do with whether
someone uses memcached?

> Any other approaches ?

Sean's pgmemcache approach is quite likely portable to your database of
choice, but not necessary for most uses. Dirty the cache when your data
changes, and you're set.

-- 
Ivan Krstic <krstic at fas.harvard.edu> | 0x147C722D


More information about the memcached mailing list