below is the scenario: here is a access statistic system, just like Blogger's overviewstats function. Statistic data is stored persistent in database(like MySQL), while using a key-value cache(now is memcache) to cache the access counts, each access only update the value in cache.
Now the question is how to synch back the latest count value to database? A normal solution is to write back after some interval, but memcache will discard items when there is no enough spaces, some updates may lost. so I think a better solution is if memcache can send a message(like JMS) when discarding an item, and then i can synch that item to database. It seems that memcache does not provide this function, is there any other key-value cache can do this? Or is there any better solutions?