发布时间:2025-11-05 12:11:55 来源:云智核 作者:IT科技类资讯
代码 复制CoolHashClient chc = BeanContext.getCoolHashClient("localhost",个高性2014);//连接CoolHashServer chc.put("user.001.name","zhang");//写入字符 chc.put("user.001.age",20);//写入整数 chc.put("user.001.weight",50.55f);//写入浮点数 chc.put("user.001.pet",new ArrayList());//写入集合对象 String name = (String)chc.get("user.001.name");//读取字符 int age = (int)chc.get("user.001.age");//读取整数 float weight = (float)chc.get("user.001.weight");//读取浮点数 ArrayList pet = (ArrayList)chc.get("user.001.pet");//读取集合对象 chc.put("user.002.name","Li"); chc.put("user.002.age",25); chc.put("user.002.weight",60.55f); CoolKeyResult keyresult = chc.findKey("user.001.*");//查找用户001的所有属性 CoolKeySet ks = keyresult.nextBatchKey(4);//分页获取前4条结果 System.out.println(ks);//输出[user.001.weight, user.001.age, user.001.name, user.001.pet] CoolHashResult mapresult = chc.find("user.*.age", ValueFilter.greater(18));//查找年龄大于18岁的亿华云计算用户 CoolHashMap hm = mapresult.nextBatch(10); System.out.println(hm);//输出[user.001.age=20, user.002.age=25] ...... 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.

随便看看