@@ -10,37 +10,37 @@ public abstract partial class BaseClient : IGenericBaseCommands
1010{
1111 public async Task < bool > KeyDeleteAsync ( ValkeyKey key , CommandFlags flags = CommandFlags . None )
1212 {
13- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
13+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
1414 return await Command ( Request . KeyDeleteAsync ( key ) ) ;
1515 }
1616
1717 public async Task < long > KeyDeleteAsync ( ValkeyKey [ ] keys , CommandFlags flags = CommandFlags . None )
1818 {
19- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
19+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
2020 return await Command ( Request . KeyDeleteAsync ( keys ) ) ;
2121 }
2222
2323 public async Task < bool > KeyUnlinkAsync ( ValkeyKey key , CommandFlags flags = CommandFlags . None )
2424 {
25- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
25+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
2626 return await Command ( Request . KeyUnlinkAsync ( key ) ) ;
2727 }
2828
2929 public async Task < long > KeyUnlinkAsync ( ValkeyKey [ ] keys , CommandFlags flags = CommandFlags . None )
3030 {
31- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
31+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
3232 return await Command ( Request . KeyUnlinkAsync ( keys ) ) ;
3333 }
3434
3535 public async Task < bool > KeyExistsAsync ( ValkeyKey key , CommandFlags flags = CommandFlags . None )
3636 {
37- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
37+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
3838 return await Command ( Request . KeyExistsAsync ( key ) ) ;
3939 }
4040
4141 public async Task < long > KeyExistsAsync ( ValkeyKey [ ] keys , CommandFlags flags = CommandFlags . None )
4242 {
43- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
43+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
4444 return await Command ( Request . KeyExistsAsync ( keys ) ) ;
4545 }
4646
@@ -49,7 +49,7 @@ public async Task<bool> KeyExpireAsync(ValkeyKey key, TimeSpan? expiry, CommandF
4949
5050 public async Task < bool > KeyExpireAsync ( ValkeyKey key , TimeSpan ? expiry , ExpireWhen when , CommandFlags flags = CommandFlags . None )
5151 {
52- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
52+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
5353 return await Command ( Request . KeyExpireAsync ( key , expiry , when ) ) ;
5454 }
5555
@@ -58,138 +58,138 @@ public async Task<bool> KeyExpireAsync(ValkeyKey key, DateTime? expiry, CommandF
5858
5959 public async Task < bool > KeyExpireAsync ( ValkeyKey key , DateTime ? expiry , ExpireWhen when , CommandFlags flags = CommandFlags . None )
6060 {
61- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
61+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
6262 return await Command ( Request . KeyExpireAsync ( key , expiry , when ) ) ;
6363 }
6464
6565 public async Task < TimeSpan ? > KeyTimeToLiveAsync ( ValkeyKey key , CommandFlags flags = CommandFlags . None )
6666 {
67- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
67+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
6868 return await Command ( Request . KeyTimeToLiveAsync ( key ) ) ;
6969 }
7070
7171 public async Task < ValkeyType > KeyTypeAsync ( ValkeyKey key , CommandFlags flags = CommandFlags . None )
7272 {
73- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
73+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
7474 return await Command ( Request . KeyTypeAsync ( key ) ) ;
7575 }
7676
7777 public async Task < bool > KeyRenameAsync ( ValkeyKey key , ValkeyKey newKey , CommandFlags flags = CommandFlags . None )
7878 {
79- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
79+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
8080 return await Command ( Request . KeyRenameAsync ( key , newKey ) ) ;
8181 }
8282
8383 public async Task < bool > KeyRenameNXAsync ( ValkeyKey key , ValkeyKey newKey , CommandFlags flags = CommandFlags . None )
8484 {
85- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
85+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
8686 return await Command ( Request . KeyRenameNXAsync ( key , newKey ) ) ;
8787 }
8888
8989 public async Task < bool > KeyPersistAsync ( ValkeyKey key , CommandFlags flags = CommandFlags . None )
9090 {
91- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
91+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
9292 return await Command ( Request . KeyPersistAsync ( key ) ) ;
9393 }
9494
9595 public async Task < byte [ ] ? > KeyDumpAsync ( ValkeyKey key , CommandFlags flags = CommandFlags . None )
9696 {
97- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
97+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
9898 return await Command ( Request . KeyDumpAsync ( key ) ) ;
9999 }
100100
101101 public async Task KeyRestoreAsync ( ValkeyKey key , byte [ ] value , TimeSpan ? expiry = null , RestoreOptions ? restoreOptions = null , CommandFlags flags = CommandFlags . None )
102102 {
103- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
103+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
104104 _ = await Command ( Request . KeyRestoreAsync ( key , value , expiry , restoreOptions ) ) ;
105105 }
106106
107107 public async Task KeyRestoreDateTimeAsync ( ValkeyKey key , byte [ ] value , DateTime ? expiry = null , RestoreOptions ? restoreOptions = null , CommandFlags flags = CommandFlags . None )
108108 {
109- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
109+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
110110 _ = await Command ( Request . KeyRestoreDateTimeAsync ( key , value , expiry , restoreOptions ) ) ;
111111 }
112112
113113 public async Task < bool > KeyTouchAsync ( ValkeyKey key , CommandFlags flags = CommandFlags . None )
114114 {
115- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
115+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
116116 return await Command ( Request . KeyTouchAsync ( key ) ) ;
117117 }
118118
119119 public async Task < long > KeyTouchAsync ( ValkeyKey [ ] keys , CommandFlags flags = CommandFlags . None )
120120 {
121- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
121+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
122122 return await Command ( Request . KeyTouchAsync ( keys ) ) ;
123123 }
124124
125125 public async Task < DateTime ? > KeyExpireTimeAsync ( ValkeyKey key , CommandFlags flags = CommandFlags . None )
126126 {
127- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
127+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
128128 return await Command ( Request . KeyExpireTimeAsync ( key ) ) ;
129129 }
130130
131131 public async Task < string ? > KeyEncodingAsync ( ValkeyKey key , CommandFlags flags = CommandFlags . None )
132132 {
133- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
133+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
134134 return await Command ( Request . KeyEncodingAsync ( key ) ) ;
135135 }
136136
137137 public async Task < long ? > KeyFrequencyAsync ( ValkeyKey key , CommandFlags flags = CommandFlags . None )
138138 {
139- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
139+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
140140 return await Command ( Request . KeyFrequencyAsync ( key ) ) ;
141141 }
142142
143143 public async Task < long ? > KeyIdleTimeAsync ( ValkeyKey key , CommandFlags flags = CommandFlags . None )
144144 {
145- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
145+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
146146 return await Command ( Request . KeyIdleTimeAsync ( key ) ) ;
147147 }
148148
149149 public async Task < long ? > KeyRefCountAsync ( ValkeyKey key , CommandFlags flags = CommandFlags . None )
150150 {
151- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
151+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
152152 return await Command ( Request . KeyRefCountAsync ( key ) ) ;
153153 }
154154
155155 public async Task < bool > KeyCopyAsync ( ValkeyKey sourceKey , ValkeyKey destinationKey , bool replace = false , CommandFlags flags = CommandFlags . None )
156156 {
157- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
157+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
158158 return await Command ( Request . KeyCopyAsync ( sourceKey , destinationKey , replace ) ) ;
159159 }
160160
161161 public async Task < bool > KeyMoveAsync ( ValkeyKey key , int database , CommandFlags flags = CommandFlags . None )
162162 {
163- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
163+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
164164 return await Command ( Request . KeyMoveAsync ( key , database ) ) ;
165165 }
166166
167167 public async Task < bool > KeyCopyAsync ( ValkeyKey sourceKey , ValkeyKey destinationKey , int destinationDatabase , bool replace = false , CommandFlags flags = CommandFlags . None )
168168 {
169- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
169+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
170170 return await Command ( Request . KeyCopyAsync ( sourceKey , destinationKey , destinationDatabase , replace ) ) ;
171171 }
172172 public async Task < string ? > KeyRandomAsync ( CommandFlags flags = CommandFlags . None )
173173 {
174- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
174+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
175175 return await Command ( Request . KeyRandomAsync ( ) ) ;
176176 }
177177
178178 public async Task < ValkeyValue [ ] > SortAsync ( ValkeyKey key , long skip = 0 , long take = - 1 , Order order = Order . Ascending , SortType sortType = SortType . Numeric , ValkeyValue by = default , ValkeyValue [ ] ? get = null , CommandFlags flags = CommandFlags . None )
179179 {
180- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
180+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
181181 return await Command ( Request . SortAsync ( key , skip , take , order , sortType , by , get , await GetServerVersionAsync ( ) ) ) ;
182182 }
183183
184184 public async Task < long > SortAndStoreAsync ( ValkeyKey destination , ValkeyKey key , long skip = 0 , long take = - 1 , Order order = Order . Ascending , SortType sortType = SortType . Numeric , ValkeyValue by = default , ValkeyValue [ ] ? get = null , CommandFlags flags = CommandFlags . None )
185185 {
186- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
186+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
187187 return await Command ( Request . SortAndStoreAsync ( destination , key , skip , take , order , sortType , by , get ) ) ;
188188 }
189189
190190 public async Task < long > WaitAsync ( long numreplicas , long timeout , CommandFlags flags = CommandFlags . None )
191191 {
192- Utils . Requires < NotImplementedException > ( flags == CommandFlags . None , "Command flags are not supported by GLIDE" ) ;
192+ GuardClauses . ThrowIfCommandFlags ( flags ) ;
193193 return await Command ( Request . WaitAsync ( numreplicas , timeout ) ) ;
194194 }
195195
0 commit comments