diff --git a/src/FreeRedis/IRedisClient.cs b/src/FreeRedis/IRedisClient.cs index c2b5d62..8d91ec6 100644 --- a/src/FreeRedis/IRedisClient.cs +++ b/src/FreeRedis/IRedisClient.cs @@ -184,7 +184,7 @@ public interface IRedisClient SubscribeListBroadcastObject SubscribeListBroadcast(string listKey, string clientId, Action onMessage); SubscribeStreamObject SubscribeStream(string streamKey, Action> 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(); @@ -532,7 +532,7 @@ public interface IRedisClient Task JsonToggleAsync(string key, string path = "$"); Task JsonTypeAsync(string key, string path = "$"); Task PublishAsync(string channel, string message); - Task PubSubChannelsAsync(string pattern); + Task PubSubChannelsAsync(string pattern = "*"); Task PubSubNumSubAsync(string channel); Task PubSubNumSubAsync(string[] channels); Task PubSubNumPatAsync(); diff --git a/src/FreeRedis/RedisClient/PubSub.cs b/src/FreeRedis/RedisClient/PubSub.cs index 8e42831..58435e0 100644 --- a/src/FreeRedis/RedisClient/PubSub.cs +++ b/src/FreeRedis/RedisClient/PubSub.cs @@ -37,7 +37,7 @@ partial class RedisClient #if isasync #region async (copy from sync) public Task PublishAsync(string channel, string message) => CallAsync("PUBLISH".Input(channel, message), rt => rt.ThrowOrValue()); - public Task PubSubChannelsAsync(string pattern) => CallAsync("PUBSUB".SubCommand("CHANNELS").Input(pattern), rt => rt.ThrowOrValue()); + public Task PubSubChannelsAsync(string pattern = "*") => CallAsync("PUBSUB".SubCommand("CHANNELS").Input(pattern), rt => rt.ThrowOrValue()); public Task PubSubNumSubAsync(string channel) => CallAsync("PUBSUB".SubCommand("NUMSUB").Input(channel), rt => rt.ThrowOrValue((a, _) => a.MapToList((x, y) => y.ConvertTo()).FirstOrDefault())); public Task PubSubNumSubAsync(string[] channels) => CallAsync("PUBSUB".SubCommand("NUMSUB").Input(channels), rt => rt.ThrowOrValue((a, _) => a.MapToList((x, y) => y.ConvertTo()).ToArray())); public Task PubSubNumPatAsync() => CallAsync("PUBLISH".SubCommand("NUMPAT"), rt => rt.ThrowOrValue()); @@ -58,7 +58,7 @@ public IDisposable PSubscribe(string[] pattern, Action handler) } public long Publish(string channel, string message) => Call("PUBLISH".Input(channel, message), rt => rt.ThrowOrValue()); - public string[] PubSubChannels(string pattern) => Call("PUBSUB".SubCommand("CHANNELS").Input(pattern), rt => rt.ThrowOrValue()); + public string[] PubSubChannels(string pattern = "*") => Call("PUBSUB".SubCommand("CHANNELS").Input(pattern), rt => rt.ThrowOrValue()); public long PubSubNumSub(string channel) => Call("PUBSUB".SubCommand("NUMSUB").Input(channel), rt => rt.ThrowOrValue((a, _) => a.MapToList((x, y) => y.ConvertTo()).FirstOrDefault())); public long[] PubSubNumSub(string[] channels) => Call("PUBSUB".SubCommand("NUMSUB").Input(channels), rt => rt.ThrowOrValue((a, _) => a.MapToList((x, y) => y.ConvertTo()).ToArray())); public long PubSubNumPat() => Call("PUBLISH".SubCommand("NUMPAT"), rt => rt.ThrowOrValue());