Juan Backson wrote:
Hi,
Is there anyway to have memcached to automatically sync data back to postgres? I know there is pgmemcache, but I am looking for something in the reverse direction. Is there any tool out there for this? Thanks,
jb
Juan,

There is no "automatic" way to sync data back to postgres, however, you could employ something like I've set up before. What I did (in MySQL) was for anything I stored in memcached, I made an entry of that item's key in a simple "catalogue" table. I had a trigger on this table that after so many entries would then call a Gearman worker to store the data from memcached into MySQL and remove the keys for the items stored. You could do this with pgmemcache and the Gearman functions available for Postgres as well. You just have to realize that there is the chance that if you don't pull data from the cache and store into memcached quickly enough, LRU could cause those items to be removed-- though I never rant into this. If you want to see how I did it, you can check out the project lp:~capttofu/narada/devel.

Hope this helps!

--Patrick

Reply via email to