4、使用SetOperations(无序)操作redis(Set集合)
2021-11-23 22:17
986 查看
文章来源:https://www.cnblogs.com/shiguotao-com/p/10560599.html
方法 | c参数 | s说明 |
Long add(K key, V... values); |
K key:集合key |
向集合中添加一个或多一个元素 |
Long remove(K key, Object... values); |
K key:集合key |
删除集合中一个或多个元素 |
V pop(K key); |
K key:集合key |
随机删除集合中一个元素 |
List<V> pop(K key, long count); |
K key:集合key |
随机删除集合中一个或多个元素 |
Boolean move(K key, V value, K destKey); |
K key:集合key |
将某一个集合中的元素移动到目标集合中 |
Long size(K key); |
K key:集合key |
获取集合长度 |
Boolean isMember(K key, Object o); |
K key:集合key |
检查集合中是否存在某个元素 |
Set<V> intersect(K key, K otherKey); |
K key:集合A的key |
获取集合A和集合B的交集 |
Set<V> intersect(K key, Collection<K> otherKeys); |
K key:集合A的key |
获取集合A和其他的交集 |
Long intersectAndStore(K key, K otherKey, K destKey); |
K key:集合A的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 |
获取集合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 |
将集合A和集合B合并后的结果存放到集合C中 |
Long unionAndStore(K key, Collection<K> otherKeys, K destKey); |
K key:集合A的key |
将集合A和其他集合合并后的结果存放到集合C中 |
Set<V> difference(K key, K otherKey); |
K key:集合A的key |
获取集合A和集合B的差集 |
Set<V> difference(K key, Collection<K> otherKeys); |
K key:集合A的key |
获取集合A和其他集合的差集 |
Long differenceAndStore(K key, K otherKey, K destKey); |
K key:集合A的key |
将集合A和集合B的差集存放到集合C中 |
Long differenceAndStore(K key, Collection<K> otherKeys, K destKey); |
K key:集合A的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个不同的元素 |
List<V> randomMembers(K key, long count); |
K key:集合A的key |
在集合中随机获取count个元素 |
Cursor<V> scan(K key, ScanOptions options); |
K key:集合A的key |
扫描整个集合一匹配所需元素 |
相关文章推荐
- redis 的使用 ( set集合类型操作)
- 【Redis缓存机制】6.Set集合类型操作使用
- 【Redis缓存机制】6.Set集合类型操作使用
- 【Redis缓存机制】6.Set集合类型操作使用
- redis 的使用 (sort set排序集合类型操作)
- Redis入门之 redis set集合的操作
- Redis简单入门五——对Set集合的操作
- Redis无序集合数据类型操作命令
- Redis初探06——Redis的有序集合sorted set类型及操作
- Redis 集合 set 操作, 有序集合
- 使用redis的set集合做缓存统计
- python对redis的常用操作 下 (无序集合,有序集合)
- 【Redis缓存机制】8.Hash集合类型操作使用
- 【Redis缓存机制】7.SortSet排序集合类型操作
- Redis 的set集合使用及set集合和list列表的区别
- Python 操作redis有序集合(sorted set)
- 四:redis的sets类型相关操作(有序和无序集合)
- Redis简单入门六——通过事务操作有序集合(sorted set)
- java操作redis数据库三:set集合
- redis基础简介(二)- hash(哈希)、set(集合)、sorted set(有序集合)以及键操作