This commit is contained in:
@@ -16,6 +16,7 @@ import javax.persistence.*;
|
|||||||
* @author zhangjx
|
* @author zhangjx
|
||||||
*/
|
*/
|
||||||
public class CacheTestBean {
|
public class CacheTestBean {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
private long pkgid;
|
private long pkgid;
|
||||||
|
|
||||||
@@ -35,12 +36,12 @@ public class CacheTestBean {
|
|||||||
EntityCache<CacheTestBean> cache = new EntityCache(EntityInfo.load(CacheTestBean.class, 0, true, null));
|
EntityCache<CacheTestBean> cache = new EntityCache(EntityInfo.load(CacheTestBean.class, 0, true, null));
|
||||||
cache.fullLoad(list);
|
cache.fullLoad(list);
|
||||||
|
|
||||||
System.out.println(cache.getMapResult("pkgid", Reckon.COUNT, "name", null,null));
|
System.out.println(cache.getMapResult("pkgid", Reckon.COUNT, "name", null));
|
||||||
System.out.println(cache.getMapResult("pkgid", Reckon.DISTINCTCOUNT, "name", null,null));
|
System.out.println(cache.getMapResult("pkgid", Reckon.DISTINCTCOUNT, "name", null));
|
||||||
System.out.println(cache.getMapResult("pkgid", Reckon.AVG, "price", null,null));
|
System.out.println(cache.getMapResult("pkgid", Reckon.AVG, "price", null));
|
||||||
System.out.println(cache.getMapResult("pkgid", Reckon.SUM, "price", null,null));
|
System.out.println(cache.getMapResult("pkgid", Reckon.SUM, "price", null));
|
||||||
System.out.println(cache.getMapResult("pkgid", Reckon.MAX, "price", null,null));
|
System.out.println(cache.getMapResult("pkgid", Reckon.MAX, "price", null));
|
||||||
System.out.println(cache.getMapResult("pkgid", Reckon.MIN, "price", null,null));
|
System.out.println(cache.getMapResult("pkgid", Reckon.MIN, "price", null));
|
||||||
}
|
}
|
||||||
|
|
||||||
public CacheTestBean() {
|
public CacheTestBean() {
|
||||||
|
|||||||
@@ -17,6 +17,20 @@ import javax.persistence.*;
|
|||||||
*/
|
*/
|
||||||
public class TestSourceCache {
|
public class TestSourceCache {
|
||||||
|
|
||||||
|
public static class TestEntityBean implements FilterBean {
|
||||||
|
|
||||||
|
@FilterColumn(express = FilterExpress.GREATERTHAN)
|
||||||
|
public int userid;
|
||||||
|
|
||||||
|
@FilterColumn(express = FilterExpress.LIKE)
|
||||||
|
public String username;
|
||||||
|
|
||||||
|
public TestEntityBean(int userid, String username) {
|
||||||
|
this.userid = userid;
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
final EntityInfo<TestEntity> info = EntityInfo.load(TestEntity.class, 0, false, null);
|
final EntityInfo<TestEntity> info = EntityInfo.load(TestEntity.class, 0, false, null);
|
||||||
TestEntity[] entitys = new TestEntity[10_0000];
|
TestEntity[] entitys = new TestEntity[10_0000];
|
||||||
@@ -39,7 +53,9 @@ public class TestSourceCache {
|
|||||||
flipper.setSort("userid DESC, createtime DESC");
|
flipper.setSort("userid DESC, createtime DESC");
|
||||||
final FilterNode node = FilterNode.create("userid", FilterExpress.GREATERTHAN, 1000).and("username", FilterExpress.LIKE, "用户");
|
final FilterNode node = FilterNode.create("userid", FilterExpress.GREATERTHAN, 1000).and("username", FilterExpress.LIKE, "用户");
|
||||||
System.out.println("node = " + node);
|
System.out.println("node = " + node);
|
||||||
Sheet<TestEntity> sheet = info.getCache().querySheet(true, null, flipper, node, null);
|
Sheet<TestEntity> sheet = info.getCache().querySheet(null, flipper, node);
|
||||||
|
System.out.println(sheet);
|
||||||
|
System.out.println(info.getCache().querySheet(null, flipper, null, new TestEntityBean(1000, "用户")));
|
||||||
final CountDownLatch cdl = new CountDownLatch(100);
|
final CountDownLatch cdl = new CountDownLatch(100);
|
||||||
s = System.currentTimeMillis();
|
s = System.currentTimeMillis();
|
||||||
for (int i = 0; i < 100; i++) {
|
for (int i = 0; i < 100; i++) {
|
||||||
@@ -47,7 +63,7 @@ public class TestSourceCache {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (int k = 0; k < 10; k++) {
|
for (int k = 0; k < 10; k++) {
|
||||||
info.getCache().querySheet(true, null, flipper, node, null);
|
info.getCache().querySheet(true, null, flipper, node);
|
||||||
}
|
}
|
||||||
cdl.countDown();
|
cdl.countDown();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user