This repository was archived by the owner on Dec 24, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +9
-9
lines changed
tests/ServiceStack.Redis.Tests Expand file tree Collapse file tree 3 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -412,8 +412,8 @@ public IRedisPipeline CreatePipeline()
412
412
413
413
public List < string > SearchKeys ( string pattern )
414
414
{
415
- var multiDataList = Keys ( pattern ) ;
416
- return multiDataList . ToStringList ( ) ;
415
+ var multiDataList = ScanAllKeys ( pattern ) ;
416
+ return multiDataList . ToList ( ) ;
417
417
}
418
418
419
419
public List < string > GetValues ( List < string > keys )
@@ -961,7 +961,7 @@ public string LoadLuaScript(string body)
961
961
962
962
public void RemoveByPattern ( string pattern )
963
963
{
964
- var keys = Keys ( pattern ) . ToStringArray ( ) ;
964
+ var keys = ScanAllKeys ( pattern ) . ToArray ( ) ;
965
965
if ( keys . Length > 0 )
966
966
Del ( keys ) ;
967
967
}
Original file line number Diff line number Diff line change @@ -181,8 +181,7 @@ public void RemoveByPattern(string pattern)
181
181
{
182
182
using ( var client = GetClient ( ) )
183
183
{
184
- var redisClient = client as IRemoveByPattern ;
185
- if ( redisClient != null )
184
+ if ( client is IRemoveByPattern redisClient )
186
185
{
187
186
redisClient . RemoveByPattern ( pattern ) ;
188
187
}
@@ -193,8 +192,7 @@ public void RemoveByRegex(string pattern)
193
192
{
194
193
using ( var client = GetClient ( ) )
195
194
{
196
- var redisClient = client as IRemoveByPattern ;
197
- if ( redisClient != null )
195
+ if ( client is IRemoveByPattern redisClient )
198
196
{
199
197
redisClient . RemoveByRegex ( pattern ) ;
200
198
}
@@ -205,8 +203,7 @@ public void RemoveByRegex(string pattern)
205
203
{
206
204
using ( var client = GetClient ( ) )
207
205
{
208
- var redisClient = client as ICacheClientExtended ;
209
- if ( redisClient != null )
206
+ if ( client is ICacheClientExtended redisClient )
210
207
{
211
208
return redisClient . GetTimeToLive ( key ) ;
212
209
}
Original file line number Diff line number Diff line change @@ -311,6 +311,9 @@ public void Can_get_Keys_with_pattern()
311
311
312
312
var keys = Redis . Keys ( "k1:*" ) ;
313
313
Assert . That ( keys . Length , Is . EqualTo ( 5 ) ) ;
314
+
315
+ var scanKeys = Redis . ScanAllKeys ( "k1:*" ) . ToArray ( ) ;
316
+ Assert . That ( scanKeys . Length , Is . EqualTo ( 5 ) ) ;
314
317
}
315
318
316
319
[ Test ]
You can’t perform that action at this time.
0 commit comments