refactoring

pull/2085/head
Nikita Koksharov 6 years ago
parent 3e110e033e
commit cf1404c960

@ -350,24 +350,6 @@ public class JCache<K, V> extends RedissonObject implements Cache<K, V> {
return getAccessTimeout(System.currentTimeMillis()); return getAccessTimeout(System.currentTimeMillis());
} }
V load(K key) {
RLock lock = getLockedLock(key);
try {
V value;
if (atomicExecution) {
value = getValue(key);
} else {
value = getValueLocked(key);
}
if (value == null) {
value = loadValue(key);
}
return value;
} finally {
lock.unlock();
}
}
V loadValue(K key) { V loadValue(K key) {
V value = null; V value = null;
try { try {
@ -829,9 +811,9 @@ public class JCache<K, V> extends RedissonObject implements Cache<K, V> {
cacheManager.getStatBean(this).addHits(1); cacheManager.getStatBean(this).addHits(1);
result.put(entry.getKey(), entry.getValue()); result.put(entry.getKey(), entry.getValue());
} else { } else {
if (config.isReadThrough()) {
cacheManager.getStatBean(this).addMisses(1); cacheManager.getStatBean(this).addMisses(1);
V value = load(entry.getKey()); if (config.isReadThrough()) {
V value = loadValue(entry.getKey());
if (value != null) { if (value != null) {
result.put(entry.getKey(), value); result.put(entry.getKey(), value);
} }

@ -67,7 +67,7 @@ public class JMutableEntry<K, V> implements MutableEntry<K, V> {
if (value != null) { if (value != null) {
action = Action.READ; action = Action.READ;
} else if (isReadThrough) { } else if (isReadThrough) {
value = jCache.load(key); value = jCache.loadValue(key);
if (value != null) { if (value != null) {
action = Action.LOADED; action = Action.LOADED;
} }

Loading…
Cancel
Save