#1060 - findSingleAttributeList doesn't store result in L2 query cache

This commit is contained in:
rob bygrave
2017-07-06 21:35:20 +12:00
parent 7a697c12af
commit 95aed6af54
7 changed files with 74 additions and 30 deletions
@@ -183,33 +183,32 @@ final class BeanDescriptorCacheHelp<T> {
/**
* Get a query result from the query cache.
*/
@SuppressWarnings("unchecked")
BeanCollection<T> queryCacheGet(Object id) {
Object queryCacheGet(Object id) {
if (queryCache == null) {
throw new IllegalStateException("No query cache enabled on " + desc + ". Need explicit @Cache(enableQueryCache=true)");
}
BeanCollection<T> list = (BeanCollection<T>) queryCache.get(id);
Object queryResult = queryCache.get(id);
if (queryLog.isDebugEnabled()) {
if (list == null) {
if (queryResult == null) {
queryLog.debug(" GET {}({}) - cache miss", cacheName, id);
} else {
queryLog.debug(" GET {}({}) - hit", cacheName, id);
}
}
return list;
return queryResult;
}
/**
* Put a query result into the query cache.
*/
void queryCachePut(Object id, BeanCollection<T> query) {
void queryCachePut(Object id, Object queryResult) {
if (queryCache == null) {
throw new IllegalStateException("No query cache enabled on " + desc + ". Need explicit @Cache(enableQueryCache=true)");
}
if (queryLog.isDebugEnabled()) {
queryLog.debug(" PUT {}({})", cacheName, id);
}
queryCache.put(id, query);
queryCache.put(id, queryResult);
}