I use memcached to cache the db data. Sometimes, found db and cache data is not
consistent when I wrote below cases. The issue can occur with 10%.
1, One thread update a db key and remove the key in memcached in a while loop
(10 count).
for (int i=0; i<10; i++) {
Thread.sleep(10ms);
dbstore.update(key, obj);
mcclient.delete(key);
}
2, While step 1 runing, I launch 100 threads to get the key using the
api(set(key, cacheTime, object)) in same JVM.
Thread.sleep(10ms);
if (mcclient.get(key) == null) {
mcclient.set(key, cacheTime, object);
}
3, when step 2 finished, I check the DB data and Memcached data, found
sometimes, they are different.
dbstore.get(key);
mcclient.get(key);
BTW, mcclient 2.4 to 2.8, all have the issue. anyone can help me? or I did a
wrong invoking? or there is issue when remove and set concurrently?
Original issue reported on code.google.com by nsqn...@gmail.com on 3 Jul 2012 at 9:23
Original issue reported on code.google.com by
nsqn...@gmail.com
on 3 Jul 2012 at 9:23