#1222 - Extend L2 ServerCache API with putAll(), getAll() and removeAll() methods

This commit is contained in:
Rob Bygrave
2017-12-13 19:58:28 +13:00
parent c7f4b56dd1
commit 4d0b29624e
7 changed files with 100 additions and 33 deletions
@@ -33,6 +33,8 @@ import io.ebean.plugin.BeanDocType;
import io.ebean.plugin.BeanType;
import io.ebean.plugin.ExpressionPath;
import io.ebean.plugin.Property;
import io.ebean.util.SplitName;
import io.ebeaninternal.api.BeanCacheResult;
import io.ebeaninternal.api.CQueryPlanKey;
import io.ebeaninternal.api.ConcurrencyMode;
import io.ebeaninternal.api.LoadContext;
@@ -62,8 +64,6 @@ import io.ebeaninternal.server.el.ElPropertyValue;
import io.ebeaninternal.server.persist.DmlUtil;
import io.ebeaninternal.server.query.CQueryPlan;
import io.ebeaninternal.server.query.CQueryPlanStats.Snapshot;
import io.ebean.util.SplitName;
import io.ebeaninternal.api.BeanCacheResult;
import io.ebeaninternal.server.querydefn.OrmQueryDetail;
import io.ebeaninternal.server.rawsql.SpiRawSql;
import io.ebeaninternal.server.text.json.ReadJson;
@@ -1348,6 +1348,17 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
cacheHelp.beanCachePut(bean);
}
@SuppressWarnings("unchecked")
public void cacheBeanPutAll(Collection<?> beans) {
if (!beans.isEmpty()) {
cacheHelp.beanPutAll((Collection<EntityBean>)beans);
}
}
void cacheBeanPutAllDirect(Collection<EntityBean> beans) {
cacheHelp.beanCachePutAllDirect(beans);
}
/**
* Put a bean into the cache as the correct type.
*/