类 RedisPubSubClusterPolicy
java.lang.Object
redis.clients.jedis.JedisPubSub
net.oschina.j2cache.redis.RedisPubSubClusterPolicy
- 所有已实现的接口:
ClusterPolicy
public class RedisPubSubClusterPolicy
extends redis.clients.jedis.JedisPubSub
implements ClusterPolicy
使用 Redis 的订阅和发布进行集群中的节点通知
该策略器使用 j2cache.properties 中的 redis 配置自行保持两个到 redis 的连接用于发布和订阅消息(并在失败时自动重连)
- 作者:
- Winter Lau(javayou@gmail.com)
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明void清除本地整个缓存区域voidconnect(Properties props, CacheProviderHolder holder) 加入 Redis 的发布订阅频道void退出 Redis 发布订阅频道void删除本地某个缓存条目booleanisLocalCommand(Command cmd) 判断是否本地实例的命令void当接收到订阅频道获得的消息时触发此方法void发送消息void从类继承的方法 redis.clients.jedis.JedisPubSub
getSubscribedChannels, isSubscribed, onPMessage, onPong, onPSubscribe, onPUnsubscribe, onSubscribe, onUnsubscribe, ping, proceed, proceedWithPatterns, psubscribe, punsubscribe, punsubscribe, subscribe, unsubscribe从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 net.oschina.j2cache.cluster.ClusterPolicy
handleCommand, sendClearCmd, sendEvictCmd
-
构造器详细资料
-
RedisPubSubClusterPolicy
-
-
方法详细资料
-
isLocalCommand
从接口复制的说明:ClusterPolicy判断是否本地实例的命令- 指定者:
isLocalCommand在接口中ClusterPolicy- 参数:
cmd- 命令信息- 返回:
- true if the cmd sent by self
-
evict
删除本地某个缓存条目- 指定者:
evict在接口中ClusterPolicy- 参数:
region- 区域名称keys- 缓存键值
-
clear
清除本地整个缓存区域- 指定者:
clear在接口中ClusterPolicy- 参数:
region- 区域名称
-
connect
加入 Redis 的发布订阅频道- 指定者:
connect在接口中ClusterPolicy- 参数:
props- j2cache 配置信息holder- Cache Provider Instance
-
disconnect
public void disconnect()退出 Redis 发布订阅频道- 指定者:
disconnect在接口中ClusterPolicy
-
publish
从接口复制的说明:ClusterPolicy发送消息- 指定者:
publish在接口中ClusterPolicy- 参数:
cmd- command to send
-
onMessage
当接收到订阅频道获得的消息时触发此方法- 覆盖:
onMessage在类中redis.clients.jedis.JedisPubSub- 参数:
channel- 频道名称message- 消息体
-
unsubscribe
public void unsubscribe()- 覆盖:
unsubscribe在类中redis.clients.jedis.JedisPubSub
-