zoukankan      html  css  js  c++  java
  • 使用SetOperations(无序)操作redis

    方法 c参数 s说明
    Long add(K key, V... values);
    K key:集合key 
    V... values:key对应的值
    向集合中添加一个或多一个元素
    Long remove(K key, Object... values);
    K key:集合key 
    V... values:key对应的值
    删除集合中一个或多个元素
    V pop(K key);
     
    K key:集合key 
    随机删除集合中一个元素
    List<V> pop(K key, long count);
    K key:集合key 
    long count:数量
    随机删除集合中一个或多个元素
    Boolean move(K key, V value, K destKey);
    K key:集合key 
    V value:key对应的某个值
    K destKey:目标集合
    将某一个集合中的元素移动到目标集合中
    Long size(K key);
    K key:集合key 
    获取集合长度
    Boolean isMember(K key, Object o);
    K key:集合key 
    V value:key对应的某个值
    检查集合中是否存在某个元素
    Set<V> intersect(K key, K otherKey);
    K key:集合A的key 
    K otherKey:集合B的key
    获取集合A和集合B的交集
    Set<V> intersect(K key, Collection<K> otherKeys);
     
    K key:集合A的key
    Collection<K> otherKeys:其他集合的集合(可多个)
     获取集合A和其他的交集
     
    Long intersectAndStore(K key, K otherKey, K destKey);
     
    K key:集合A的key 
    K otherKey:集合B的key
    K destKey:集合C的key
     将集合A和集合B的交集存放到集合C中
     
    Long intersectAndStore(K key, Collection<K> otherKeys, K destKey);
     
    K key:集合A的key 
    Collection<K> otherKeys:其他集合的key(可多个)
    K destKey:集合C的key
     将集合A和其他集合的交集存放到集合C中
     
    Set<V> union(K key, K otherKey);
     
    K key:集合A的key 
    K otherKey:集合B的key
     获取集合A和集合B集合合并后的集合
     
    Set<V> union(K key, Collection<K> otherKeys);
     
    K key:集合A的key 
    Collection<K> otherKeys:其他集合的key(可多个)
     获取集合A和其他集合(多个)合并后的集合
     
    Long unionAndStore(K key, K otherKey, K destKey);
     
    K key:集合A的key 
    K otherKey:集合B的key
    K destKey:集合C的key
     将集合A和集合B合并后的结果存放到集合C中
     
    Long unionAndStore(K key, Collection<K> otherKeys, K destKey);
     
    K key:集合A的key 
    Collection<K> otherKeys:其他集合的key(可多个)
    K destKey:集合C的key
     将集合A和其他集合合并后的结果存放到集合C中
     
    Set<V> difference(K key, K otherKey);
     
    K key:集合A的key 
    K otherKey:集合B的key
     获取集合A和集合B的差集
     
    Set<V> difference(K key, Collection<K> otherKeys);
     
    K key:集合A的key 
    Collection<K> otherKeys:其他集合的key(可多个)
     获取集合A和其他集合的差集
     
    Long differenceAndStore(K key, K otherKey, K destKey);
     
    K key:集合A的key 
    K otherKey:集合B的key
    K destKey:集合C的key
     将集合A和集合B的差集存放到集合C中
     
    Long differenceAndStore(K key, Collection<K> otherKeys, K destKey);
     
    K key:集合A的key 
    Collection<K> otherKeys:其他集合的key(可多个)
    K destKey:集合C的key
      将集合A和其他集合的差集存放到集合C中
     
    Set<V> members(K key);
     
    K key:集合A的key 
     获取集合中的多有元素
     
    V randomMember(K key);
     
    K key:集合A的key 
     在集合中随机获取一个元素
     
    Set<V> distinctRandomMembers(K key, long count);
     
    K key:集合A的key 
    count:数量
     在集合中随机获取count个不同的元素
     
    List<V> randomMembers(K key, long count);
     
    K key:集合A的key 
    count:数量
     在集合中随机获取count个元素
     
    Cursor<V> scan(K key, ScanOptions options);
     
    K key:集合A的key 
    ScanOptions options:扫描选项对象
     扫描整个集合一匹配所需元素
  • 相关阅读:
    NGINX -- 详解Nginx几种常见实现301重定向方法上的区别
    数据库外键的使用以及优缺点
    phpok -- 域名问题
    Sql Server系列:多表连接查询
    Go -- cron定时任务的用法
    JavaScript -- 清除缓存
    sql CAST用法
    Mock -- 数据模拟
    EsLint入门
    citus real-time 分析demo( 来自官方文档)
  • 原文地址:https://www.cnblogs.com/shiguotao-com/p/10560599.html
Copyright © 2011-2022 走看看