mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Feature/cache improvements 2 (#1067)
* New Mode to control queryCache behavior * Collections form the cache have to be read only * findCount not queried in query cache * return modifiable collections from the cache * FIX: Compile errors * No effective code change: reformat code / javadoc
This commit is contained in:
committed by
Rob Bygrave
parent
b8e1dffca2
commit
a6e4e181bf
@@ -1,5 +1,6 @@
|
||||
package io.ebeaninternal.server.querydefn;
|
||||
|
||||
import io.ebean.CacheMode;
|
||||
import io.ebean.EbeanServer;
|
||||
import io.ebean.Expression;
|
||||
import io.ebean.ExpressionFactory;
|
||||
@@ -195,7 +196,7 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
|
||||
|
||||
private boolean excludeBeanCache;
|
||||
|
||||
private Boolean useQueryCache;
|
||||
private CacheMode useQueryCache = CacheMode.OFF;
|
||||
|
||||
private Boolean readOnly;
|
||||
|
||||
@@ -1094,9 +1095,13 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseQueryCache() {
|
||||
public CacheMode getUseQueryCache() {
|
||||
// not using L2 cache for asDraft() query
|
||||
return !isAsDraft() && Boolean.TRUE.equals(useQueryCache);
|
||||
if (isAsDraft()) {
|
||||
return CacheMode.OFF;
|
||||
} else {
|
||||
return useQueryCache;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1106,7 +1111,7 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultOrmQuery<T> setUseQueryCache(boolean useQueryCache) {
|
||||
public DefaultOrmQuery<T> setUseQueryCache(CacheMode useQueryCache) {
|
||||
this.useQueryCache = useQueryCache;
|
||||
return this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user