@@ -23,29 +23,89 @@ public async Task<long> PublishAsync(string channel, string message)
2323 #endregion
2424 #region SubscribeCommands
2525
26+ public async Task SubscribeAsync ( string channel , TimeSpan timeout = default )
27+ {
28+ GuardClauses . ThrowIfTimeSpanNegative ( timeout ) ;
29+ await Command ( Request . SubscribeBlocking ( [ channel ] , ( uint ) timeout . TotalMilliseconds ) ) ;
30+ }
31+
32+ public async Task SubscribeAsync ( IEnumerable < string > channels , TimeSpan timeout = default )
33+ {
34+ GuardClauses . ThrowIfTimeSpanNegative ( timeout ) ;
35+ await Command ( Request . SubscribeBlocking ( channels . ToGlideStrings ( ) , ( uint ) timeout . TotalMilliseconds ) ) ;
36+ }
37+
2638 public async Task SubscribeLazyAsync ( string channel )
2739 => await Command ( Request . Subscribe ( [ channel ] ) ) ;
2840
2941 public async Task SubscribeLazyAsync ( IEnumerable < string > channels )
30- => await Command ( Request . Subscribe ( channels . ToHashSet ( ) . ToGlideStrings ( ) ) ) ;
42+ => await Command ( Request . Subscribe ( channels . ToGlideStrings ( ) ) ) ;
43+
44+ public async Task PSubscribeAsync ( string pattern , TimeSpan timeout = default )
45+ {
46+ GuardClauses . ThrowIfTimeSpanNegative ( timeout ) ;
47+ await Command ( Request . PSubscribeBlocking ( [ pattern ] , ( uint ) timeout . TotalMilliseconds ) ) ;
48+ }
49+
50+ public async Task PSubscribeAsync ( IEnumerable < string > patterns , TimeSpan timeout = default )
51+ {
52+ GuardClauses . ThrowIfTimeSpanNegative ( timeout ) ;
53+ await Command ( Request . PSubscribeBlocking ( patterns . ToGlideStrings ( ) , ( uint ) timeout . TotalMilliseconds ) ) ;
54+ }
3155
3256 public async Task PSubscribeLazyAsync ( string pattern )
3357 => await Command ( Request . PSubscribe ( [ pattern ] ) ) ;
3458
3559 public async Task PSubscribeLazyAsync ( IEnumerable < string > patterns )
36- => await Command ( Request . PSubscribe ( patterns . ToHashSet ( ) . ToGlideStrings ( ) ) ) ;
60+ => await Command ( Request . PSubscribe ( patterns . ToGlideStrings ( ) ) ) ;
3761
3862 #endregion
3963 #region UnsubscribeCommands
4064
65+ public async Task UnsubscribeAsync ( TimeSpan timeout = default )
66+ {
67+ GuardClauses . ThrowIfTimeSpanNegative ( timeout ) ;
68+ await Command ( Request . UnsubscribeBlocking ( [ ] , ( uint ) timeout . TotalMilliseconds ) ) ;
69+ }
70+
71+ public async Task UnsubscribeAsync ( string channel , TimeSpan timeout = default )
72+ {
73+ GuardClauses . ThrowIfTimeSpanNegative ( timeout ) ;
74+ await Command ( Request . UnsubscribeBlocking ( [ channel ] , ( uint ) timeout . TotalMilliseconds ) ) ;
75+ }
76+
77+ public async Task UnsubscribeAsync ( IEnumerable < string > channels , TimeSpan timeout = default )
78+ {
79+ GuardClauses . ThrowIfTimeSpanNegative ( timeout ) ;
80+ await Command ( Request . UnsubscribeBlocking ( channels . ToGlideStrings ( ) , ( uint ) timeout . TotalMilliseconds ) ) ;
81+ }
82+
4183 public async Task UnsubscribeLazyAsync ( )
4284 => await Command ( Request . Unsubscribe ( [ ] ) ) ;
4385
4486 public async Task UnsubscribeLazyAsync ( string channel )
4587 => await Command ( Request . Unsubscribe ( [ channel ] ) ) ;
4688
4789 public async Task UnsubscribeLazyAsync ( IEnumerable < string > channels )
48- => await Command ( Request . Unsubscribe ( channels . ToHashSet ( ) . ToGlideStrings ( ) ) ) ;
90+ => await Command ( Request . Unsubscribe ( channels . ToGlideStrings ( ) ) ) ;
91+
92+ public async Task PUnsubscribeAsync ( TimeSpan timeout = default )
93+ {
94+ GuardClauses . ThrowIfTimeSpanNegative ( timeout ) ;
95+ await Command ( Request . PUnsubscribeBlocking ( [ ] , ( uint ) timeout . TotalMilliseconds ) ) ;
96+ }
97+
98+ public async Task PUnsubscribeAsync ( string pattern , TimeSpan timeout = default )
99+ {
100+ GuardClauses . ThrowIfTimeSpanNegative ( timeout ) ;
101+ await Command ( Request . PUnsubscribeBlocking ( [ pattern ] , ( uint ) timeout . TotalMilliseconds ) ) ;
102+ }
103+
104+ public async Task PUnsubscribeAsync ( IEnumerable < string > patterns , TimeSpan timeout = default )
105+ {
106+ GuardClauses . ThrowIfTimeSpanNegative ( timeout ) ;
107+ await Command ( Request . PUnsubscribeBlocking ( patterns . ToGlideStrings ( ) , ( uint ) timeout . TotalMilliseconds ) ) ;
108+ }
49109
50110 public async Task PUnsubscribeLazyAsync ( )
51111 => await Command ( Request . PUnsubscribe ( [ ] ) ) ;
@@ -54,7 +114,7 @@ public async Task PUnsubscribeLazyAsync(string pattern)
54114 => await Command ( Request . PUnsubscribe ( [ pattern ] ) ) ;
55115
56116 public async Task PUnsubscribeLazyAsync ( IEnumerable < string > patterns )
57- => await Command ( Request . PUnsubscribe ( patterns . ToHashSet ( ) . ToGlideStrings ( ) ) ) ;
117+ => await Command ( Request . PUnsubscribe ( patterns . ToGlideStrings ( ) ) ) ;
58118
59119 #endregion
60120 #region IntrospectionCommands
@@ -66,7 +126,7 @@ public async Task<ISet<string>> PubSubChannelsAsync(string pattern)
66126 => await Command ( Request . PubSubChannels ( pattern ) ) ;
67127
68128 public async Task < Dictionary < string , long > > PubSubNumSubAsync ( IEnumerable < string > channels )
69- => await Command ( Request . PubSubNumSub ( channels . ToHashSet ( ) . ToGlideStrings ( ) ) ) ;
129+ => await Command ( Request . PubSubNumSub ( channels . ToGlideStrings ( ) ) ) ;
70130
71131 public async Task < long > PubSubNumPatAsync ( )
72132 => await Command ( Request . PubSubNumPat ( ) ) ;
0 commit comments