public final class PubSubHandler extends Object implements RedisHandler
Modifier and Type | Method and Description |
---|---|
void |
addPSubChannels(String... patterns)
添加给定模式字符串订阅频道
|
void |
addSubChannels(String... channels)
添加字符串订阅频道
|
<T> T |
deserialize(byte[] bytes)
反序列化
|
<T> T |
deserialize(Class<T> type,
byte[] bytes)
反序列化
|
List<String> |
getChannels()
获取订阅频道
|
List<String> |
getPatterns()
获取订阅模式
|
org.springframework.data.redis.core.RedisTemplate<String,Object> |
getRedisTemplate()
获取spring redis模板
|
void |
pSubscribe(org.springframework.data.redis.connection.MessageListener listener,
String... patterns)
订阅给定模式的频道
|
void |
publish(String channel,
Object message)
发布消息
|
void |
pUnsubscribe(String... patterns)
退订给定模式频道
|
void |
subscribe(org.springframework.data.redis.connection.MessageListener listener,
String... channels)
订阅频道
|
void |
unsubscribe(String... channels)
退订频道
|
public void publish(String channel, Object message)
channel
- 频道message
- 消息public void subscribe(org.springframework.data.redis.connection.MessageListener listener, String... channels)
listener
- 监听器channels
- 频道public void pSubscribe(org.springframework.data.redis.connection.MessageListener listener, String... patterns)
listener
- 监听器patterns
- 模式public void addSubChannels(String... channels)
channels
- 频道public void addPSubChannels(String... patterns)
patterns
- 模式public void unsubscribe(String... channels)
channels
- 频道public void pUnsubscribe(String... patterns)
patterns
- 模式public <T> T deserialize(byte[] bytes)
T
- 返回类型bytes
- 字节数组public <T> T deserialize(Class<T> type, byte[] bytes)
T
- 返回类型type
- 返回值类型bytes
- 字节数组Copyright © 2019. All rights reserved.