drop memory caches only when is dirty

This commit is contained in:
Eugene Zhuravlev
2012-01-28 19:24:45 +01:00
parent d9b03b365f
commit ccd42f640f
3 changed files with 9 additions and 3 deletions
@@ -34,7 +34,9 @@ public abstract class AbstractStateStorage<Key, T> {
public void dropMemoryCache() {
synchronized (myDataLock) {
myMap.dropMemoryCaches();
if (myMap.isDirty()) {
myMap.dropMemoryCaches();
}
}
}
@@ -108,7 +108,9 @@ public class PersistentMaplet<K, V> implements Maplet<K, V> {
public void flush(boolean memoryCachesOnly) {
if (memoryCachesOnly) {
myMap.dropMemoryCaches();
if (myMap.isDirty()) {
myMap.dropMemoryCaches();
}
}
else {
myMap.force();
@@ -169,7 +169,9 @@ class PersistentMultiMaplet<K, V> implements MultiMaplet<K, V> {
public void flush(boolean memoryCachesOnly) {
if (memoryCachesOnly) {
myMap.dropMemoryCaches();
if (myMap.isDirty()) {
myMap.dropMemoryCaches();
}
}
else {
myMap.force();