Fix logic that was failing to cache results on cache miss.
This commit is contained in:
parent
e932d0dcf2
commit
1eccb631f3
4 changed files with 7 additions and 16 deletions
|
@ -22,8 +22,7 @@ import java.util.Map;
|
||||||
import net.helenus.core.*;
|
import net.helenus.core.*;
|
||||||
import net.helenus.mapping.HelenusProperty;
|
import net.helenus.mapping.HelenusProperty;
|
||||||
|
|
||||||
public abstract class AbstractFilterStreamOperation<
|
public abstract class AbstractFilterStreamOperation<E, O extends AbstractFilterStreamOperation<E, O>>
|
||||||
E, O extends AbstractFilterStreamOperation<E, O>>
|
|
||||||
extends AbstractStreamOperation<E, O> {
|
extends AbstractStreamOperation<E, O> {
|
||||||
|
|
||||||
protected Map<HelenusProperty, Filter<?>> filters = null;
|
protected Map<HelenusProperty, Filter<?>> filters = null;
|
||||||
|
|
|
@ -164,16 +164,12 @@ public abstract class AbstractOptionalOperation<E, O extends AbstractOptionalOpe
|
||||||
SerializationUtils.<Serializable>clone(
|
SerializationUtils.<Serializable>clone(
|
||||||
(Serializable) cachedResult));
|
(Serializable) cachedResult));
|
||||||
}
|
}
|
||||||
|
updateCache = false;
|
||||||
sessionCacheHits.mark();
|
sessionCacheHits.mark();
|
||||||
cacheHits.mark();
|
cacheHits.mark();
|
||||||
uow.recordCacheAndDatabaseOperationCount(1, 0);
|
uow.recordCacheAndDatabaseOperationCount(1, 0);
|
||||||
if (result.isPresent()) {
|
} else {
|
||||||
updateCache = true;
|
updateCache = true;
|
||||||
} else {
|
|
||||||
updateCache = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
updateCache = false;
|
|
||||||
sessionCacheMiss.mark();
|
sessionCacheMiss.mark();
|
||||||
cacheMiss.mark();
|
cacheMiss.mark();
|
||||||
uow.recordCacheAndDatabaseOperationCount(-1, 0);
|
uow.recordCacheAndDatabaseOperationCount(-1, 0);
|
||||||
|
@ -184,9 +180,9 @@ public abstract class AbstractOptionalOperation<E, O extends AbstractOptionalOpe
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//TODO(gburd): look in statement cache for results
|
//TODO(gburd): look in statement cache for results
|
||||||
|
updateCache = false; //true;
|
||||||
cacheMiss.mark();
|
cacheMiss.mark();
|
||||||
uow.recordCacheAndDatabaseOperationCount(-1, 0);
|
uow.recordCacheAndDatabaseOperationCount(-1, 0);
|
||||||
updateCache = false; //true;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
updateCache = false;
|
updateCache = false;
|
||||||
|
|
|
@ -168,17 +168,13 @@ public abstract class AbstractStreamOperation<E, O extends AbstractStreamOperati
|
||||||
result =
|
result =
|
||||||
(E) SerializationUtils.<Serializable>clone((Serializable) cachedResult);
|
(E) SerializationUtils.<Serializable>clone((Serializable) cachedResult);
|
||||||
}
|
}
|
||||||
|
updateCache = false;
|
||||||
resultStream = Stream.of(result);
|
resultStream = Stream.of(result);
|
||||||
sessionCacheHits.mark();
|
sessionCacheHits.mark();
|
||||||
cacheHits.mark();
|
cacheHits.mark();
|
||||||
uow.recordCacheAndDatabaseOperationCount(1, 0);
|
uow.recordCacheAndDatabaseOperationCount(1, 0);
|
||||||
if (result != null) {
|
} else {
|
||||||
updateCache = true;
|
updateCache = true;
|
||||||
} else {
|
|
||||||
updateCache = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
updateCache = false;
|
|
||||||
sessionCacheMiss.mark();
|
sessionCacheMiss.mark();
|
||||||
cacheMiss.mark();
|
cacheMiss.mark();
|
||||||
uow.recordCacheAndDatabaseOperationCount(-1, 0);
|
uow.recordCacheAndDatabaseOperationCount(-1, 0);
|
||||||
|
|
|
@ -61,7 +61,7 @@ public @interface Column {
|
||||||
boolean forceQuote() default false;
|
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.
|
* objects in the session cache to be evicted.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
|
|
Loading…
Reference in a new issue