Skip to content

Commit b35f6a3

Browse files
author
Costin Leau
committed
convertAndSend returns the nr of targeted channels
1 parent d01f13a commit b35f6a3

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/main/java/org/springframework/data/redis/core/RedisOperations.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public interface RedisOperations<K, V> {
117117
List<Object> exec();
118118

119119
// pubsub functionality on the template
120-
void convertAndSend(String destination, Object message);
120+
Long convertAndSend(String destination, Object message);
121121

122122

123123
// operation types

src/main/java/org/springframework/data/redis/core/RedisTemplate.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -484,17 +484,16 @@ public Boolean doInRedis(RedisConnection connection) {
484484
}
485485

486486

487-
public void convertAndSend(String channel, Object message) {
487+
public Long convertAndSend(String channel, Object message) {
488488
Assert.hasText(channel, "a non-empty channel is required");
489489

490490
final byte[] rawChannel = rawString(channel);
491491
final byte[] rawMessage = rawValue(message);
492492

493-
execute(new RedisCallback<Object>() {
493+
return execute(new RedisCallback<Long>() {
494494

495-
public Object doInRedis(RedisConnection connection) {
496-
connection.publish(rawChannel, rawMessage);
497-
return null;
495+
public Long doInRedis(RedisConnection connection) {
496+
return connection.publish(rawChannel, rawMessage);
498497
}
499498
}, true);
500499
}
@@ -511,7 +510,7 @@ public Long getExpire(K key) {
511510
return execute(new RedisCallback<Long>() {
512511

513512
public Long doInRedis(RedisConnection connection) {
514-
return Long.valueOf(connection.ttl(rawKey));
513+
return connection.ttl(rawKey);
515514
}
516515
}, true);
517516
}

0 commit comments

Comments
 (0)