zoukankan      html  css  js  c++  java
  • 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());
            }
        }
  • 相关阅读:
    做汉堡(续)
    做汉堡
    <构建之法>3-5章感想
    《构建之法》1-2章感想
    四则运算界面练习
    快速排序
    冒泡算法(思路1)
    希尔排序
    KMP算法
    1、基础算法题
  • 原文地址:https://www.cnblogs.com/aoeiuv/p/6760781.html
Copyright © 2011-2022 走看看