ShardedJedisClient 如何去如何清空redis缓存存

上一篇中介绍了ShardedJedis的基本使用方法以及演示了一个简单的例子,在这一篇中我们来介绍了ShardedJedis的原理。
1.ShardedJedis内部实现
首先我们来看一下ShardedJedis的一个继承关系
看完了图,那么我们一步一步跟着我们的代码调用来看,以我们最简单的 ShardedJedis.get(key)方法为例:
public String get(String key) {
Jedis j = getShard(key);
return j.get(key);
这边有调用一个getShard 方法,参数为我们传入的key,然后返回一个普通的jedis对象,那么这个getShard是用来做什么的呢,大家可能已经猜到了,这个方法就是会根据我们传入的key做一致性哈希判断,然后返回key落到的那个redis实例上的一个redis连接,不同的key返回的redis连接可能是不同的。
进入getShard 方法,你会发现这个实现是在Sharded类中实现的(看上面的类图可以发现顶层的Sharded类),代码如下:
public R getShard(String key) {
return resources.get(getShardInfo(key));
public S getShardInfo(byte[] key) {
SortedMap&Long, S& tail = nodes.tailMap(algo.hash(key));
if (tail.isEmpty()) {
return nodes.get(nodes.firstKey());
return tail.get(tail.firstKey());
public S getShardInfo(String key) {
return getShardInfo(SafeEncoder.encode(getKeyTag(key)));
上面的方法是层层调用的关系,在这边不细说,我们主要看下第二个方法(getShardInfo(byte[] key))实现(上面的nodes变量是一个TreeMap 类型, algo 是Hashing类型,即key分片所使用的hash算法,这个在前一篇有简单说过),那么这段代码的含义我们大概成猜出来了,
就是在一个TreeMap中取出大于等于key之后的部分视图SortMap
在SortMap取得第一个键值对的值,然后返回一个 S 对象,
然后根据这个S 对象,去resources(resources = new LinkedHashMap&ShardInfo&R&, R&())中get一个R对象
那么这个S、 R对象各自代表什么呢?看下面的代码
public class Sharded&R, S extends ShardInfo&R&&
public class BinaryShardedJedis extends Sharded&Jedis, JedisShardInfo& implements
BinaryJedisCommands
可以得出& S = JedisShardInfo, R = Jedis 对象,即在TreeMap存储了服务器划分的虚拟节点的信息,LinkedHashMap中存储了服务器的物理连接。&
JedisShardInfo具体信息如下:里面包含了jedis服务器的一些信息,最重要的是它的父类中有一个weight字段,作为本jedis服务器的权值。
ok,那我们了解了实际上就是根据jedis服务器的信息去获取一个jedis的连接,返回给上层调用。
我们可以梳理下这个逻辑:
当我们使用ShardedJedis去查一个key时,首先它会把这个key进行一个hash算法
根据这个hash值然后去treeMap中,查出这个key落在哪个实例中,并返回redis实例对应的具体信息
根据这个redis的实例信息,到一个保存jedis链接和实例信息对应关系的LinkedHashMap中找到这个jedis连接
最终返回jedis连接,执行对象的命令操作(到这步后实际上和单机操作一样了)
那么我们的nodes 服务器虚拟节点和resources 服务器物理连接是什么时候初始化的呢,接下来继续看
2.redis虚拟节点(nodes)和物理连接(resources) 初始化
我们继续看Sharded的构造方法
public Sharded(List&S& shards, Hashing algo) {
this.algo =
initialize(shards);
public Sharded(List&S& shards, Hashing algo, Pattern tagPattern) {
this.algo =
this.tagPattern = tagP
initialize(shards);
这边有一个initialize方法,就是用来对虚拟节点和物理连接进行初始化的,看其实现
private void initialize(List&S& shards) {
nodes = new TreeMap&Long, S&();
for (int i = 0; i != shards.size(); ++i) {
final S shardInfo = shards.get(i);
if (shardInfo.getName() == null) for (int n = 0; n & 160 * shardInfo.getWeight(); n++) {
nodes.put(this.algo.hash("SHARD-" + i + "-NODE-" + n), shardInfo);
else for (int n = 0; n & 160 * shardInfo.getWeight(); n++) {
nodes.put(this.algo.hash(shardInfo.getName() + "*" + shardInfo.getWeight() + n), shardInfo);
resources.put(shardInfo, shardInfo.createResource());
具体细节就不说了,根据上面的,我们就知道是在这边进行了初始化,将每台服务器节点采用hash算法划分为160个虚拟节点(可以配置划分权重),保存在TreeMap中,
然后把每台服务器节点的信息和物理连接以键值对保存LinkedHashMap中。
然后通过一系列的查找,发现Sharded的构造方法其实是在我们 jedisPool.getResource() 时就完成的
  //初始化ShardedJedisPool
List&JedisShardInfo& infoList = Arrays.asList(shardInfo1, shardInfo2, shardInfo3);
ShardedJedisPool jedisPool = new ShardedJedisPool(poolConfig, infoList);
ShardedJedis jedis = jedisPool.getResource();
纳尼? 每次jedisPool.getResource()
才初始化?那会不会造成很慢呢,其实不用担心,其底层是使用了commons.pool来进行连接池的一些操作,会根据我们配置的连接池参数来生成对应的连接并保存,其中的细节很复杂,博主没有继续深究,实现其实和数据库连接池是一致的。
ShardedJedis分布式具体的的实现思路:
redis服务器节点划分:将每台服务器节点采用hash算法划分为160个虚拟节点(可以配置划分权重)
将划分虚拟节点采用TreeMap存储
对每个redis服务器的物理连接采用LinkedHashMap存储
对Key or KeyTag 采用同样的hash算法,然后从TreeMap获取大于等于键hash值得节点,取最邻近节点存储;当key的hash值大于虚拟节点hash值得最大值时,存入第一个虚拟节点
sharded采用的hash算法:MD5 和 MurmurHash两种;默认采用64位的MurmurHash算法;
&好了,大概的实现如上面所说的,都是图可能会有点乱,大家如果有什么问题或者发现了什么错误,please tell me!
阅读(...) 评论()博客分类:
一、Jedis分布式(Sharding/shared 一致性哈希)
我们知道Memcached是完全基于分布式的集群,而Redis是Master-Slave的模式,如果想把Redis做成集群模式,其实无外乎就是多做几套Master-Slave,每套Master-Slave完成各自的容灾处理,通过Client工具,完成一致性哈希。(PS:Memcached是在Server端完成Sharding,Redis只能依靠各个Client做Sharding。但比较开心的是从3.0的正式版开始,Redis也会像Memache一样开始支持Server端的集群)
shared一致性哈希采用以下方案:
Redis服务器节点划分:将每台服务器节点采用hash算法划分为160个虚拟节点(可以配置划分权重)
将划分虚拟节点采用TreeMap存储
对每个Redis服务器的物理连接采用LinkedHashMap存储
对Key or KeyTag 采用同样的hash算法,然后从TreeMap获取大于等于键hash值得节点,取最邻近节点存储;当key的hash值大于虚拟节点hash值得最大值时,存入第一个虚拟节点
sharded采用的hash算法:MD5 和 MurmurHash两种;默认采用64位的MurmurHash算法;
二、Jedis分布式代码示例片段:(开始之前可参照上一篇Jedis的基本使用)
使用上一篇中的JedisPoolConfig,新增两个Redis的IP,此处假设为redis1.ip和redis2.ip。需要添加的代码就是新增两个JedisShardInfo实例,并将其放进List中:
bundle.getString("redis1.ip"), Integer.valueOf(bundle
.getString("redis.port")));
JedisShardInfo jedisShardInfo2 = new JedisShardInfo(
bundle.getString("redis2.ip"), Integer.valueOf(bundle
.getString("redis.port")));
List&JedisShardInfo& list = new LinkedList&JedisShardInfo&();
list.add(jedisShardInfo1);
list.add(jedisShardInfo2);
初始化ShardedJedisPool代替JedisPool:
ShardedJedisPool pool = new ShardedJedisPool(config, list);
改由ShardedJedis,获取Jedis对象:
// 从池中获取一个Jedis对象
ShardedJedis jedis = pool.getResource();
String keys = "name";
String value = "snowolf";
jedis.del(keys);
jedis.set(keys, value);
String v = jedis.get(keys);
System.out.println(v);
// 释放对象池
pool.returnResource(jedis);
通过以上方式,向redis进行set操作的key-value,会通过hash而均匀的分配到pool里的redis机器中。
三、使用Shading和非Shading的示例:
package com.chuanliu.platform.activity.
import java.util.ArrayL
import java.util.L
import org.junit.B
import org.junit.T
import redis.clients.jedis.J
import redis.clients.jedis.JedisP
import redis.clients.jedis.JedisPoolC
import redis.clients.jedis.JedisShardI
import redis.clients.jedis.ShardedJ
import redis.clients.jedis.ShardedJedisP
* The unit test used to simulate the distribution(master/slave)
* of Redis
* @author Josh Wang(Sheng)
public class TestCombination {
* 非切片客户端链接
* 非切片链接池
private JedisPool jedisP
* 切片客户端链接
private ShardedJedis shardedJ
* 切片链接池
private ShardedJedisPool shardedJedisP
private String ip = "172.16.205.186";
* 构造函数
public void init() {
initialPool();
initialShardedPool();
shardedJedis = shardedJedisPool.getResource();
jedis = jedisPool.getResource();
private void initialPool() {
// 池基本配置
JedisPoolConfig config = new JedisPoolConfig();
config.setMaxActive(20);
config.setMaxIdle(5);
config.setMaxWait(1000l);
config.setTestOnBorrow(false);
jedisPool = new JedisPool(config, ip, 6379);
* 初始化切片池
private void initialShardedPool() {
// 池基本配置
JedisPoolConfig config = new JedisPoolConfig();
config.setMaxActive(20);
config.setMaxIdle(5);
config.setMaxWait(1000l);
config.setTestOnBorrow(false);
// slave链接
List&JedisShardInfo& shards = new ArrayList&JedisShardInfo&();
shards.add(new JedisShardInfo(ip, 6379, "master"));
shardedJedisPool = new ShardedJedisPool(config, shards);
public void show() {
// key检测
testKey();
// string检测
testString();
// list检测
testList();
// set检测
testSet();
// sortedSet检测
testSortedSet();
// hash检测
testHash();
shardedJedisPool.returnResource(shardedJedis);
private void testKey() {
System.out.println("=============key==========================");
// 清空数据
System.out.println(jedis.flushDB());
System.out.println(jedis.echo("foo"));
// 判断key否存在
System.out.println(shardedJedis.exists("foo"));
shardedJedis.set("key", "values");
System.out.println(shardedJedis.exists("key"));
private void testString() {
System.out.println("=============String==========================");
// 清空数据
System.out.println(jedis.flushDB());
// 存储数据
shardedJedis.set("foo", "bar");
System.out.println(shardedJedis.get("foo"));
// 若key不存在,则存储
shardedJedis.setnx("foo", "foo not exits");
System.out.println(shardedJedis.get("foo"));
// 覆盖数据
shardedJedis.set("foo", "foo update");
System.out.println(shardedJedis.get("foo"));
// 追加数据
shardedJedis.append("foo", " hello, world");
System.out.println(shardedJedis.get("foo"));
// 设置key的有效期,并存储数据
shardedJedis.setex("foo", 2, "foo not exits");
System.out.println(shardedJedis.get("foo"));
Thread.sleep(3000);
} catch (InterruptedException e) {
System.out.println(shardedJedis.get("foo"));
// 获取并更改数据
shardedJedis.set("foo", "foo update");
System.out.println(shardedJedis.getSet("foo", "foo modify"));
// 截取value的值
System.out.println(shardedJedis.getrange("foo", 1, 3));
System.out.println(jedis.mset("mset1", "mvalue1", "mset2", "mvalue2",
"mset3", "mvalue3", "mset4", "mvalue4"));
System.out.println(jedis.mget("mset1", "mset2", "mset3", "mset4"));
System.out.println(jedis.del(new String[] { "foo", "foo1", "foo3" }));
private void testList() {
System.out.println("=============list==========================");
// 清空数据
System.out.println(jedis.flushDB());
// 添加数据
shardedJedis.lpush("lists", "vector");
shardedJedis.lpush("lists", "ArrayList");
shardedJedis.lpush("lists", "LinkedList");
// 数组长度
System.out.println(shardedJedis.llen("lists"));
System.out.println(shardedJedis.sort("lists"));
System.out.println(shardedJedis.lrange("lists", 0, 3));
// 修改列表中单个值
shardedJedis.lset("lists", 0, "hello list!");
// 获取列表指定下标的值
System.out.println(shardedJedis.lindex("lists", 1));
// 删除列表指定下标的值
System.out.println(shardedJedis.lrem("lists", 1, "vector"));
// 删除区间以外的数据
System.out.println(shardedJedis.ltrim("lists", 0, 1));
// 列表出栈
System.out.println(shardedJedis.lpop("lists"));
// 整个列表值
System.out.println(shardedJedis.lrange("lists", 0, -1));
private void testSet() {
System.out.println("=============set==========================");
// 清空数据
System.out.println(jedis.flushDB());
// 添加数据
shardedJedis.sadd("sets", "HashSet");
shardedJedis.sadd("sets", "SortedSet");
shardedJedis.sadd("sets", "TreeSet");
// 判断value是否在列表中
System.out.println(shardedJedis.sismember("sets", "TreeSet"));
// 整个列表值
System.out.println(shardedJedis.smembers("sets"));
// 删除指定元素
System.out.println(shardedJedis.srem("sets", "SortedSet"));
System.out.println(shardedJedis.spop("sets"));
System.out.println(shardedJedis.smembers("sets"));
shardedJedis.sadd("sets1", "HashSet1");
shardedJedis.sadd("sets1", "SortedSet1");
shardedJedis.sadd("sets1", "TreeSet");
shardedJedis.sadd("sets2", "HashSet2");
shardedJedis.sadd("sets2", "SortedSet1");
shardedJedis.sadd("sets2", "TreeSet1");
System.out.println(jedis.sinter("sets1", "sets2"));
System.out.println(jedis.sunion("sets1", "sets2"));
System.out.println(jedis.sdiff("sets1", "sets2"));
private void testSortedSet() {
System.out.println("=============zset==========================");
// 清空数据
System.out.println(jedis.flushDB());
// 添加数据
shardedJedis.zadd("zset", 10.1, "hello");
shardedJedis.zadd("zset", 10.0, ":");
shardedJedis.zadd("zset", 9.0, "zset");
shardedJedis.zadd("zset", 11.0, "zset!");
// 元素个数
System.out.println(shardedJedis.zcard("zset"));
// 元素下标
System.out.println(shardedJedis.zscore("zset", "zset"));
// 集合子集
System.out.println(shardedJedis.zrange("zset", 0, -1));
// 删除元素
System.out.println(shardedJedis.zrem("zset", "zset!"));
System.out.println(shardedJedis.zcount("zset", 9.5, 10.5));
// 整个集合值
System.out.println(shardedJedis.zrange("zset", 0, -1));
private void testHash() {
System.out.println("=============hash==========================");
// 清空数据
System.out.println(jedis.flushDB());
// 添加数据
shardedJedis.hset("hashs", "entryKey", "entryValue");
shardedJedis.hset("hashs", "entryKey1", "entryValue1");
shardedJedis.hset("hashs", "entryKey2", "entryValue2");
// 判断某个值是否存在
System.out.println(shardedJedis.hexists("hashs", "entryKey"));
// 获取指定的值
System.out.println(shardedJedis.hget("hashs", "entryKey"));
// 批量获取指定的值
System.out
.println(shardedJedis.hmget("hashs", "entryKey", "entryKey1"));
// 删除指定的值
System.out.println(shardedJedis.hdel("hashs", "entryKey"));
// 为key中的域 field 的值加上增量 increment
System.out.println(shardedJedis.hincrBy("hashs", "entryKey", 123l));
// 获取所有的keys
System.out.println(shardedJedis.hkeys("hashs"));
// 获取所有的values
System.out.println(shardedJedis.hvals("hashs"));
Josh_Persistence
浏览: 925842 次
来自: 上海
暴露了你的东家,, 哈哈。我没找 ...
VCenter、ESXServer、Cluster这些实体类在 ...
(window.slotbydup=window.slotbydup || []).push({
id: '4773203',
container: s,
size: '200,200',
display: 'inlay-fix'原来项目中有用到Redis用作缓存服务,刚开始时只用一台Redis就能够满足服务,随着项目的慢慢进行,发现一台满足不了现有的项目需求,因为Redis操作都是原子性这样的特性,造成有时同时读写缓存造成查询效率的下降。但是由于我们现在用的还是2.X版本,还是没有集群功能的(Redis作者在3.0版本中已经加入了集群功能), 因此只能使用2.x版本中自带的一个叫做ShardedJedis的来实现分布式缓存。
ShardedJedis是通过一致性哈希来实现分布式缓存的,通过一定的策略把不同的key分配到不同的redis server上,达到横向扩展的目的。那么ShardedJedis内部是怎么实现的呢,文章会慢慢讲解。
&1.ShardedJedis使用方法
ShardedJedis的使用方法除了配置时有点区别,其他和Jedis基本类似,有一点要注意的是 ShardedJedis不支持多命令操作,像mget、mset、brpop等可以在redis命令后一次性操作多个key的命令,具体包括哪些,大家可以看Jedis下的 MultiKeyCommands 这个类,这里面就包含了所有的多命令操作。很贴心的是,Redis作者已经把这些命令从ShardedJedis过滤掉了,使用时也调用不了这些方法,大家知道下就行了。
好了,现在来看基本的使用
  //设置连接池的相关配置
JedisPoolConfig poolConfig = new JedisPoolConfig();
poolConfig.setMaxTotal(2);
poolConfig.setMaxIdle(1);
poolConfig.setMaxWaitMillis(2000);
poolConfig.setTestOnBorrow(false);
poolConfig.setTestOnReturn(false);
//设置Redis信息
String host = "127.0.0.1";
JedisShardInfo shardInfo1 = new JedisShardInfo(host, );
shardInfo1.setPassword("test123");
JedisShardInfo shardInfo2 = new JedisShardInfo(host, );
shardInfo2.setPassword("test123");
JedisShardInfo shardInfo3 = new JedisShardInfo(host, );
shardInfo3.setPassword("test123");
//初始化ShardedJedisPool
List&JedisShardInfo& infoList = Arrays.asList(shardInfo1, shardInfo2, shardInfo3);
ShardedJedisPool jedisPool = new ShardedJedisPool(poolConfig, infoList);
//进行查询等其他操作
ShardedJedis jedis = null;
jedis = jedisPool.getResource();
  jedis.set("test", "test");
  jedis.set("test1", "test1");
String test = jedis.get("test");
System.out.println(test);
} finally {
//使用后一定关闭,还给连接池   if(jedis!=null) {
    jedis.close();    }
jedis获取后一定要关闭,这和我们使用数据库连接池是一样的,放在finally块中保证jedis的关闭.
ps:如果大家使用的jdk是1.7版本或者以上的话,可以使用1.7加入的try-with-resources语句
try(ShardedJedis jedis = jedisPool.getResource()) {
jedis.set("test", "test");
jedis.set("test1", "test1");
String test = jedis.get("test");
System.out.println(test);
try-with-resources的效果和我们上面写法是一样的,只是jedis.close()语法它会帮我们调用,它会默认调用我们在try-with-resources语句中声明的,实现了Closeable 接口的对象的close方法(像上面的ShardedJedis),我们经常用到的数据库连接Connection和一些输入输出流都可以使用这种方法。
&从代码上看,除了初始化ShardedJedisPool时需要加入多个Redis服务器信息,其他的和Jedis使用差不多。
在初始化ShardedJedisPool 时,我们还可以传入ShardedJedis采用的hash算法,支持MURMUR_HASH 和MD5两种算法,默认是使用MURMUR_HASH(可以查看redis.clients.util.Hashing 类查看相关的信息)
另外还可以传入keyTagPattern来指定我们key的分布策略,所有能够匹配keyTagPattern的key(通过正则匹配)将放在同一个redis里,默认的是直接使用key来进行判定。Redis自带了一个Sharded.keyTagPattern,如下
Pattern DEFAULT_KEY_TAG_PATTERN = Pattern.compile("\\{(.+?)\\}");
我们可以用下面的代码来实际测试下
ShardedJedis jedis = jedisPool.getResource();
jedis.set("cnblog", "cnblog");
jedis.set("redis", "redis");
jedis.set("test", "test");
jedis.set("123456", "1234567");
Client client1 = jedis.getShard("cnblog").getClient();
Client client2 = jedis.getShard("redis").getClient();
Client client3 = jedis.getShard("test").getClient();
Client client4 = jedis.getShard("123456").getClient();
////打印key在哪个server中
System.out.println("cnblog in server:" + client1.getHost() + " and port is:" + client1.getPort());
System.out.println("redis
in server:" + client2.getHost() + " and port is:" + client2.getPort());
System.out.println("test
in server:" + client3.getHost() + " and port is:" + client3.getPort());
System.out.println("123456 in server:" + client4.getHost() + " and port is:" + client4.getPort());
看输出内容:
可以看到我们保存的4个key,cnblog和redis在同一个redis server中,另外两个分别在另外的redis server中。
ShardedJedis里面采用了一致性哈希的算法,来决定每个key的保存位置,具体是怎么样计算的,在下一篇中会研究下Jedis的源码来看看。
阅读(...) 评论()redis或者缓存系统有批量删除的机制吗?
[问题点数:50分,结帖人wj_763891]
redis或者缓存系统有批量删除的机制吗?
[问题点数:50分,结帖人wj_763891]
不显示删除回复
显示所有回复
显示星级回复
显示得分回复
只显示楼主
匿名用户不能发表回复!|ShardedJedis (Jedis 2.1.0 API)
redis.clients.jedis
Class ShardedJedis
redis.clients.jedis.ShardedJedis
All Implemented Interfaces: ,
public class ShardedJedisextends implements
(&&&shards)
&&&&&&&&&&&
(&&&shards,
&&&&&&&&&&&
(&&&shards,
&keyTagPattern)
&&&&&&&&&&&
(&&&shards,
&keyTagPattern)
&&&&&&&&&&&
&&&&&&&&&&&
&&&&&&&&&&&
long&integer)
&&&&&&&&&&&
&&&&&&&&&&&
&&&&&&&&&&&
&&&&&&&&&&&
int&seconds)
&&&&&&&&&&&
long&unixTime)
&&&&&&&&&&&
&&&&&&&&&&&
long&offset)
&&&&&&&&&&&
long&startOffset,
long&endOffset)
&&&&&&&&&&&
&&&&&&&&&&&
...&fields)
&&&&&&&&&&&
&&&&&&&&&&&
&&&&&&&&&&&
&&&&&&&&&&&
long&value)
&&&&&&&&&&&
&&&&&&&&&&&
&&&&&&&&&&&
...&fields)
&&&&&&&&&&&
&&&&&&&&&&&
&&&&&&&&&&&
&&&&&&&&&&&
&&&&&&&&&&&
&&&&&&&&&&&
long&integer)
&&&&&&&&&&&
long&index)
&&&&&&&&&&&
&&&&&&&&&&&
&&&&&&&&&&&
&&&&&&&&&&&
...&strings)
&&&&&&&&&&&
&&&&&&&&&&&
long&start,
&&&&&&&&&&&
long&count,
&&&&&&&&&&&
long&index,
&&&&&&&&&&&
long&start,
&&&&&&&&&&&
&&&&&&&&&&&
...&strings)
&&&&&&&&&&&
&&&&&&&&&&&
...&members)
&&&&&&&&&&&
&&&&&&&&&&&
&&&&&&&&&&&
long&offset,
boolean&value)
&&&&&&&&&&&
int&seconds,
&&&&&&&&&&&
&&&&&&&&&&&
long&offset,
&&&&&&&&&&&
&&&&&&&&&&&
&&&&&&&&&&&
&&&&&&&&&&&
&sortingParameters)
&&&&&&&&&&&
&&&&&&&&&&&
&&&&&&&&&&&
...&members)
&&&&&&&&&&&
int&start,
&&&&&&&&&&&
&&&&&&&&&&&
&&&&&&&&&&&
double&score,
&&&&&&&&&&&
&,&&scoreMembers)
&&&&&&&&&&&
&&&&&&&&&&&
double&min,
double&max)
&&&&&&&&&&&
&&&&&&&&&&&
double&score,
&&&&&&&&&&&
long&start,
&&&&&&&&&&&
double&min,
double&max)
&&&&&&&&&&&
double&min,
double&max,
int&offset,
int&count)
&&&&&&&&&&&
&&&&&&&&&&&
int&offset,
int&count)
&&&&&&&&&&&
double&min,
double&max)
&&&&&&&&&&&
double&min,
double&max,
int&offset,
int&count)
&&&&&&&&&&&
&&&&&&&&&&&
int&offset,
int&count)
&&&&&&&&&&&
long&start,
&&&&&&&&&&&
&&&&&&&&&&&
...&members)
&&&&&&&&&&&
long&start,
&&&&&&&&&&&
double&start,
double&end)
&&&&&&&&&&&
&&&&&&&&&&&
long&start,
&&&&&&&&&&&
double&max,
double&min)
&&&&&&&&&&&
double&max,
double&min,
int&offset,
int&count)
&&&&&&&&&&&
&&&&&&&&&&&
int&offset,
int&count)
&&&&&&&&&&&
double&max,
double&min)
&&&&&&&&&&&
double&max,
double&min,
int&offset,
int&count)
&&&&&&&&&&&
&&&&&&&&&&&
int&offset,
int&count)
&&&&&&&&&&&
long&start,
&&&&&&&&&&&
&&&&&&&&&&&
&&&&&&&&&&&
, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
, , , , , ,
, , , , , , , , , ,
ShardedJedis
public ShardedJedis(&&&shards)
ShardedJedis
public ShardedJedis(&&&shards,
ShardedJedis
public ShardedJedis(&&&shards,
&keyTagPattern)
ShardedJedis
public ShardedJedis(&&&shards,
&keyTagPattern)
disconnect
public void disconnect()
Overrides: in class
Specified by: in interface
Specified by: in interface
exists(&key)
Specified by: in interface
type(&key)
Specified by: in interface
expire(&key,
int&seconds)
Specified by: in interface
expireAt(&key,
long&unixTime)
Specified by: in interface
Specified by: in interface
setbit(&key,
long&offset,
boolean&value)
Specified by: in interface
getbit(&key,
long&offset)
Specified by: in interface
setrange(&key,
long&offset,
Specified by: in interface
getrange(&key,
long&startOffset,
long&endOffset)
Specified by: in interface
getSet(&key,
Specified by: in interface
setnx(&key,
Specified by: in interface
setex(&key,
int&seconds,
Specified by: in interface
decrBy(&key,
long&integer)
Specified by: in interface
decr(&key)
Specified by: in interface
incrBy(&key,
long&integer)
Specified by: in interface
incr(&key)
Specified by: in interface
append(&key,
Specified by: in interface
substr(&key,
int&start,
Specified by: in interface
hset(&key,
Specified by: in interface
hget(&key,
Specified by: in interface
hsetnx(&key,
Specified by: in interface
hmset(&key,
Specified by: in interface
public && hmget(&key,
...&fields)
Specified by: in interface
hincrBy(&key,
long&value)
Specified by: in interface
hexists(&key,
Specified by: in interface
hdel(&key,
...&fields)
Specified by: in interface
hlen(&key)
Specified by: in interface
public && hkeys(&key)
Specified by: in interface
public && hvals(&key)
Specified by: in interface
public &,& hgetAll(&key)
Specified by: in interface
rpush(&key,
...&strings)
Specified by: in interface
lpush(&key,
...&strings)
Specified by: in interface
lpushx(&key,
Specified by: in interface
rpushx(&key,
Specified by: in interface
llen(&key)
Specified by: in interface
public && lrange(&key,
long&start,
Specified by: in interface
ltrim(&key,
long&start,
Specified by: in interface
lindex(&key,
long&index)
Specified by: in interface
lset(&key,
long&index,
Specified by: in interface
lrem(&key,
long&count,
Specified by: in interface
lpop(&key)
Specified by: in interface
rpop(&key)
Specified by: in interface
sadd(&key,
...&members)
Specified by: in interface
public && smembers(&key)
Specified by: in interface
srem(&key,
...&members)
Specified by: in interface
spop(&key)
Specified by: in interface
scard(&key)
Specified by: in interface
sismember(&key,
Specified by: in interface
srandmember
srandmember(&key)
Specified by: in interface
zadd(&key,
double&score,
Specified by: in interface
zadd(&key,
&,&&scoreMembers)
Specified by: in interface
public && zrange(&key,
long&start,
Specified by: in interface
zrem(&key,
...&members)
Specified by: in interface
zincrby(&key,
double&score,
Specified by: in interface
zrank(&key,
Specified by: in interface
zrevrank(&key,
Specified by: in interface
public && zrevrange(&key,
long&start,
Specified by: in interface
zrangeWithScores
public && zrangeWithScores(&key,
long&start,
Specified by: in interface
zrevrangeWithScores
public && zrevrangeWithScores(&key,
long&start,
Specified by: in interface
zcard(&key)
Specified by: in interface
zscore(&key,
Specified by: in interface
public && sort(&key)
Specified by: in interface
public && sort(&key,
&sortingParameters)
Specified by: in interface
zcount(&key,
double&min,
double&max)
Specified by: in interface
zcount(&key,
Specified by: in interface
zrangeByScore
public && zrangeByScore(&key,
double&min,
double&max)
Specified by: in interface
zrevrangeByScore
public && zrevrangeByScore(&key,
double&max,
double&min)
Specified by: in interface
zrangeByScore
public && zrangeByScore(&key,
double&min,
double&max,
int&offset,
int&count)
Specified by: in interface
zrevrangeByScore
public && zrevrangeByScore(&key,
double&max,
double&min,
int&offset,
int&count)
Specified by: in interface
zrangeByScoreWithScores
public && zrangeByScoreWithScores(&key,
double&min,
double&max)
Specified by: in interface
zrevrangeByScoreWithScores
public && zrevrangeByScoreWithScores(&key,
double&max,
double&min)
Specified by: in interface
zrangeByScoreWithScores
public && zrangeByScoreWithScores(&key,
double&min,
double&max,
int&offset,
int&count)
Specified by: in interface
zrevrangeByScoreWithScores
public && zrevrangeByScoreWithScores(&key,
double&max,
double&min,
int&offset,
int&count)
Specified by: in interface
zrangeByScore
public && zrangeByScore(&key,
Specified by: in interface
zrevrangeByScore
public && zrevrangeByScore(&key,
Specified by: in interface
zrangeByScore
public && zrangeByScore(&key,
int&offset,
int&count)
Specified by: in interface
zrevrangeByScore
public && zrevrangeByScore(&key,
int&offset,
int&count)
Specified by: in interface
zrangeByScoreWithScores
public && zrangeByScoreWithScores(&key,
Specified by: in interface
zrevrangeByScoreWithScores
public && zrevrangeByScoreWithScores(&key,
Specified by: in interface
zrangeByScoreWithScores
public && zrangeByScoreWithScores(&key,
int&offset,
int&count)
Specified by: in interface
zrevrangeByScoreWithScores
public && zrevrangeByScoreWithScores(&key,
int&offset,
int&count)
Specified by: in interface
zremrangeByRank
zremrangeByRank(&key,
long&start,
Specified by: in interface
zremrangeByScore
zremrangeByScore(&key,
double&start,
double&end)
Specified by: in interface
zremrangeByScore
zremrangeByScore(&key,
Specified by: in interface
linsert(&key,
Specified by: in interface
Copyright © 2012. All Rights Reserved.

我要回帖

更多关于 java 清空redis缓存 的文章

 

随机推荐