Fix logic that was failing to cache results on cache miss.

This commit is contained in:
Greg Burd 2017-11-14 15:26:16 -05:00
parent e932d0dcf2
commit 1eccb631f3
4 changed files with 7 additions and 16 deletions

View file

@ -22,8 +22,7 @@ import java.util.Map;
import net.helenus.core.*;
import net.helenus.mapping.HelenusProperty;
public abstract class AbstractFilterStreamOperation<
E, O extends AbstractFilterStreamOperation<E, O>>
public abstract class AbstractFilterStreamOperation<E, O extends AbstractFilterStreamOperation<E, O>>
extends AbstractStreamOperation<E, O> {
protected Map<HelenusProperty, Filter<?>> filters = null;

View file

@ -164,16 +164,12 @@ public abstract class AbstractOptionalOperation<E, O extends AbstractOptionalOpe
SerializationUtils.<Serializable>clone(
(Serializable) cachedResult));
}
updateCache = false;
sessionCacheHits.mark();
cacheHits.mark();
uow.recordCacheAndDatabaseOperationCount(1, 0);
if (result.isPresent()) {
updateCache = true;
} else {
updateCache = false;
}
} else {
updateCache = false;
updateCache = true;
sessionCacheMiss.mark();
cacheMiss.mark();
uow.recordCacheAndDatabaseOperationCount(-1, 0);
@ -184,9 +180,9 @@ public abstract class AbstractOptionalOperation<E, O extends AbstractOptionalOpe
}
} else {
//TODO(gburd): look in statement cache for results
updateCache = false; //true;
cacheMiss.mark();
uow.recordCacheAndDatabaseOperationCount(-1, 0);
updateCache = false; //true;
}
} else {
updateCache = false;

View file

@ -168,17 +168,13 @@ public abstract class AbstractStreamOperation<E, O extends AbstractStreamOperati
result =
(E) SerializationUtils.<Serializable>clone((Serializable) cachedResult);
}
updateCache = false;
resultStream = Stream.of(result);
sessionCacheHits.mark();
cacheHits.mark();
uow.recordCacheAndDatabaseOperationCount(1, 0);
if (result != null) {
updateCache = true;
} else {
updateCache = false;
}
} else {
updateCache = false;
updateCache = true;
sessionCacheMiss.mark();
cacheMiss.mark();
uow.recordCacheAndDatabaseOperationCount(-1, 0);

View file

@ -61,7 +61,7 @@ public @interface Column {
boolean forceQuote() default false;
/**
* Used to determin if updates can be retried. Also, mutations to this field do not trigger
* Used to determine if updates can be retried. Also, mutations to this field do not trigger
* objects in the session cache to be evicted.
*
* @return