Hi, Thanks for the solution. But I was looking for something more efficient. Suppose you have an object which you need very frequently, so you store it into memcached. But that object may change, so you may need to update. Now there are two possible approaches:
1)You update the database accordingly and store the newly formed object in the memcached.//I think this has been suggested 2)You update the object in the cache and leave the database untouched. But here you update the database whenever the object is removed from cache incase the object changed. //you may require flags here The (2) is more efficient to implement which I perceive since the database is seldom touched. And infact is the core of the dirty bit in cache of OS as I mentioned before. I rephrase my question to - is there any way we can set flags to the key:value pair which can be detected by the memcached when it removes data from memory? Please reply incase you find something related. Yours sincerely, Vishal Garg Undergraduate IIIT-Hyderabad India On Sun, Jun 5, 2011 at 12:30 AM, Dustin <[email protected]> wrote: > > On Jun 2, 10:54 pm, vishal garg <[email protected]> wrote: > >> My name is vishal and was working on memcached. I am using MySQL >> database and needed to know if the concept of dirty bit (as applicable >> in cache of OS) has ever been implemented in memcached. My problem is >> that I want to update the memcache whenever I change the user object. >> And when the memcached's implicit working detects the object has to be >> removed, I want to update my database. > > The traditional way to do that is to update your database and either > delete or replace the relevant cached items. That's very simple, as > you can do it within your DB layer and requires no magic.
