首页 > 代码库 > Spring RedisTemplate操作-HyperLogLog操作(7)
Spring RedisTemplate操作-HyperLogLog操作(7)
@Autowired @Resource(name="redisTemplate") private RedisTemplate<String, String> rt; public void flushdb(){ rt.execute(new RedisCallback<Object>() { public String doInRedis(RedisConnection connection) throws DataAccessException { connection.flushDb(); return "ok"; } }); } public void set(){ flushdb(); HyperLogLogOperations<String, String> vo = rt.opsForHyperLogLog(); vo.add("book", "a","b","c"); vo.add("bag", "a","e","d"); vo.add("del", "f","g","h"); } public void get(){ HyperLogLogOperations<String, String> vo = rt.opsForHyperLogLog(); out(vo.size("book")); out(vo.size("bag")); out(vo.size("del")); out(vo.size("book","bag","del")); vo.delete("del"); out(vo.size("book","bag","del")); vo.union("total", "book","bag","del"); out(vo.size("total")); } public void out(String str){ System.out.println(str); } public void out(Collection list){ System.out.println(list); } public void out(long num){ System.out.println(num); } public void out(boolean num){ System.out.println(num); } public void out(DataType num){ System.out.println(num); } public void out(Object str){ System.out.println(str); } public void out(Set<TypedTuple<String>> set){ for(TypedTuple<String> t : set){ System.out.println(t.getValue()+"---"+t.getScore()); } }
Spring RedisTemplate操作-HyperLogLog操作(7)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。