Skip to content

Commit

Permalink
-fix PubSubChannels #151
Browse files Browse the repository at this point in the history
  • Loading branch information
2881099 committed Jun 21, 2023
1 parent d01177c commit 1b455b3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/FreeRedis/IRedisClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public interface IRedisClient
SubscribeListBroadcastObject SubscribeListBroadcast(string listKey, string clientId, Action<string> onMessage);
SubscribeStreamObject SubscribeStream(string streamKey, Action<Dictionary<string, string>> onMessage);
long Publish(string channel, string message);
string[] PubSubChannels(string pattern);
string[] PubSubChannels(string pattern = "*");
long PubSubNumSub(string channel);
long[] PubSubNumSub(string[] channels);
long PubSubNumPat();
Expand Down Expand Up @@ -532,7 +532,7 @@ public interface IRedisClient
Task<bool[]> JsonToggleAsync(string key, string path = "$");
Task<string[]> JsonTypeAsync(string key, string path = "$");
Task<long> PublishAsync(string channel, string message);
Task<string[]> PubSubChannelsAsync(string pattern);
Task<string[]> PubSubChannelsAsync(string pattern = "*");
Task<long> PubSubNumSubAsync(string channel);
Task<long[]> PubSubNumSubAsync(string[] channels);
Task<long> PubSubNumPatAsync();
Expand Down
4 changes: 2 additions & 2 deletions src/FreeRedis/RedisClient/PubSub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ partial class RedisClient
#if isasync
#region async (copy from sync)
public Task<long> PublishAsync(string channel, string message) => CallAsync("PUBLISH".Input(channel, message), rt => rt.ThrowOrValue<long>());
public Task<string[]> PubSubChannelsAsync(string pattern) => CallAsync("PUBSUB".SubCommand("CHANNELS").Input(pattern), rt => rt.ThrowOrValue<string[]>());
public Task<string[]> PubSubChannelsAsync(string pattern = "*") => CallAsync("PUBSUB".SubCommand("CHANNELS").Input(pattern), rt => rt.ThrowOrValue<string[]>());
public Task<long> PubSubNumSubAsync(string channel) => CallAsync("PUBSUB".SubCommand("NUMSUB").Input(channel), rt => rt.ThrowOrValue((a, _) => a.MapToList((x, y) => y.ConvertTo<long>()).FirstOrDefault()));
public Task<long[]> PubSubNumSubAsync(string[] channels) => CallAsync("PUBSUB".SubCommand("NUMSUB").Input(channels), rt => rt.ThrowOrValue((a, _) => a.MapToList((x, y) => y.ConvertTo<long>()).ToArray()));
public Task<long> PubSubNumPatAsync() => CallAsync("PUBLISH".SubCommand("NUMPAT"), rt => rt.ThrowOrValue<long>());
Expand All @@ -58,7 +58,7 @@ public IDisposable PSubscribe(string[] pattern, Action<string, object> handler)
}

public long Publish(string channel, string message) => Call("PUBLISH".Input(channel, message), rt => rt.ThrowOrValue<long>());
public string[] PubSubChannels(string pattern) => Call("PUBSUB".SubCommand("CHANNELS").Input(pattern), rt => rt.ThrowOrValue<string[]>());
public string[] PubSubChannels(string pattern = "*") => Call("PUBSUB".SubCommand("CHANNELS").Input(pattern), rt => rt.ThrowOrValue<string[]>());
public long PubSubNumSub(string channel) => Call("PUBSUB".SubCommand("NUMSUB").Input(channel), rt => rt.ThrowOrValue((a, _) => a.MapToList((x, y) => y.ConvertTo<long>()).FirstOrDefault()));
public long[] PubSubNumSub(string[] channels) => Call("PUBSUB".SubCommand("NUMSUB").Input(channels), rt => rt.ThrowOrValue((a, _) => a.MapToList((x, y) => y.ConvertTo<long>()).ToArray()));
public long PubSubNumPat() => Call("PUBLISH".SubCommand("NUMPAT"), rt => rt.ThrowOrValue<long>());
Expand Down

0 comments on commit 1b455b3

Please sign in to comment.