@Cacheable增加定时更新缓存功能

This commit is contained in:
Redkale
2017-02-22 20:57:13 +08:00
parent a778af73d8
commit 58d08c5787
5 changed files with 60 additions and 21 deletions

View File

@@ -38,9 +38,9 @@ public class CacheTestBean {
BiFunction<DataSource, Class, List> fullloader = (s, z) -> list;
Method method = EntityInfo.class.getDeclaredMethod("load", Class.class, int.class, boolean.class, Properties.class,
DataSource.class, BiFunction.class);
method.setAccessible(true);
method.setAccessible(true);
final EntityInfo<CacheTestBean> info = (EntityInfo<CacheTestBean>) method.invoke(null, CacheTestBean.class, 0, true, new Properties(), null, fullloader);
EntityCache<CacheTestBean> cache = new EntityCache(info);
EntityCache<CacheTestBean> cache = new EntityCache(info, null);
cache.fullLoad();
System.out.println(cache.queryColumnMap("pkgid", FilterFunc.COUNT, "name", null));
@@ -49,9 +49,9 @@ public class CacheTestBean {
System.out.println(cache.queryColumnMap("pkgid", FilterFunc.SUM, "price", null));
System.out.println(cache.queryColumnMap("pkgid", FilterFunc.MAX, "price", null));
System.out.println(cache.queryColumnMap("pkgid", FilterFunc.MIN, "price", null));
System.out.println(cache.find(null, FilterNode.create("name", FilterExpress.EQUAL, "BB")));
System.out.println(cache.find(null, FilterNode.create("name", FilterExpress.IGNORECASEEQUAL, "BB")));
System.out.println(cache.find(null, FilterNode.create("name", FilterExpress.EQUAL, "BB")));
System.out.println(cache.find(null, FilterNode.create("name", FilterExpress.IGNORECASEEQUAL, "BB")));
System.out.println(cache.querySheet(null, null, FilterNode.create("name", FilterExpress.IGNORECASENOTLIKE, "B")));
}
@@ -90,7 +90,7 @@ public class CacheTestBean {
@Override
public String toString() {
return JsonConvert.root().convertTo(this);
return JsonConvert.root().convertTo(this);
}
}