@@ -41,6 +41,32 @@ protected override IEasyCachingProvider CreateCachingProvider(Action<BaseProvide
41
41
return serviceProvider . GetService < IEasyCachingProvider > ( ) ;
42
42
}
43
43
44
+ /*[Fact]
45
+ public async void Use_Redis6_ACL_Should_Succeed()
46
+ {
47
+ IServiceCollection services = new ServiceCollection();
48
+ services.AddEasyCaching(x =>
49
+ x.UseCSRedis(options =>
50
+ {
51
+ options.DBConfig = new CSRedisDBOptions
52
+ {
53
+ ConnectionStrings = new System.Collections.Generic.List<string>
54
+ {
55
+ "127.0.0.1:6388,user=user,password=userpwd,defaultDatabase=13,poolsize=10"
56
+ }
57
+ };
58
+ }).UseCSRedisLock().WithJson(EasyCachingConstValue.DefaultCSRedisName));
59
+ IServiceProvider serviceProvider = services.BuildServiceProvider();
60
+ var provider = serviceProvider.GetService<IEasyCachingProvider>();
61
+ var key = Guid.NewGuid().ToString();
62
+ var value = "value";
63
+ await provider.SetAsync(key, value, TimeSpan.FromSeconds(20));
64
+
65
+ var getValue = await provider.GetAsync<string>(key);
66
+
67
+ Assert.Equal(value, getValue?.Value);
68
+ }*/
69
+
44
70
[ Fact ]
45
71
public void GetDatabase_Should_Succeed ( )
46
72
{
@@ -148,7 +174,7 @@ public CSRedisCachingProviderWithKeyPrefixTest()
148
174
config . SerializerName = "json" ;
149
175
150
176
} , "WithKeyPrefix" ) ;
151
-
177
+
152
178
x . WithJson ( "json" ) ;
153
179
} ) ;
154
180
@@ -194,7 +220,7 @@ public void RemoveByPrefixTest()
194
220
Assert . False ( val3 . HasValue ) ;
195
221
Assert . False ( val4 . HasValue ) ;
196
222
}
197
-
223
+
198
224
[ Theory ]
199
225
[ InlineData ( "WithKeyPrefix" ) ]
200
226
[ InlineData ( "NotKeyPrefix" ) ]
@@ -219,7 +245,7 @@ public void RemoveByKeyPatternTest(string provider)
219
245
var val6 = WithKeyPrefix . Get < string > ( "sky:birds:bar" ) ;
220
246
var val7 = WithKeyPrefix . Get < string > ( "sky:birds:test:bar" ) ;
221
247
var val8 = WithKeyPrefix . Get < string > ( "akey" ) ;
222
-
248
+
223
249
Assert . True ( val1 . HasValue ) ;
224
250
Assert . True ( val2 . HasValue ) ;
225
251
Assert . True ( val3 . HasValue ) ;
@@ -231,15 +257,15 @@ public void RemoveByKeyPatternTest(string provider)
231
257
232
258
// contains
233
259
WithKeyPrefix . RemoveByPattern ( "*:pots:*" ) ;
234
-
260
+
235
261
// postfix
236
262
WithKeyPrefix . RemoveByPattern ( "*foo" ) ;
237
-
263
+
238
264
// prefix
239
- WithKeyPrefix . RemoveByPattern ( "sky*" ) ;
240
-
265
+ WithKeyPrefix . RemoveByPattern ( "sky*" ) ;
266
+
241
267
// exact
242
- WithKeyPrefix . RemoveByPattern ( "akey" ) ;
268
+ WithKeyPrefix . RemoveByPattern ( "akey" ) ;
243
269
244
270
var val9 = WithKeyPrefix . Get < string > ( "garden:pots:flowers" ) ;
245
271
var val10 = WithKeyPrefix . Get < string > ( "garden:pots:flowers:test" ) ;
@@ -249,7 +275,7 @@ public void RemoveByKeyPatternTest(string provider)
249
275
var val14 = WithKeyPrefix . Get < string > ( "sky:birds:bar" ) ;
250
276
var val15 = WithKeyPrefix . Get < string > ( "sky:birds:test:bar" ) ;
251
277
var val16 = WithKeyPrefix . Get < string > ( "akey" ) ;
252
-
278
+
253
279
Assert . False ( val9 . HasValue ) ;
254
280
Assert . False ( val10 . HasValue ) ;
255
281
Assert . True ( val11 . HasValue ) ;
@@ -259,8 +285,8 @@ public void RemoveByKeyPatternTest(string provider)
259
285
Assert . False ( val15 . HasValue ) ;
260
286
Assert . False ( val16 . HasValue ) ;
261
287
}
262
-
263
- [ Theory ]
288
+
289
+ [ Theory ]
264
290
[ InlineData ( "WithKeyPrefix" ) ]
265
291
[ InlineData ( "NotKeyPrefix" ) ]
266
292
public async Task RemoveByKeyPatternAsyncTest ( string provider )
@@ -284,7 +310,7 @@ public async Task RemoveByKeyPatternAsyncTest(string provider)
284
310
var val6 = WithKeyPrefix . Get < string > ( "sky:birds:bar" ) ;
285
311
var val7 = WithKeyPrefix . Get < string > ( "sky:birds:test:bar" ) ;
286
312
var val8 = WithKeyPrefix . Get < string > ( "akey" ) ;
287
-
313
+
288
314
Assert . True ( val1 . HasValue ) ;
289
315
Assert . True ( val2 . HasValue ) ;
290
316
Assert . True ( val3 . HasValue ) ;
@@ -296,15 +322,15 @@ public async Task RemoveByKeyPatternAsyncTest(string provider)
296
322
297
323
// contains
298
324
await WithKeyPrefix . RemoveByPatternAsync ( "*:pots:*" ) ;
299
-
325
+
300
326
// postfix
301
327
await WithKeyPrefix . RemoveByPatternAsync ( "*foo" ) ;
302
-
328
+
303
329
// prefix
304
- await WithKeyPrefix . RemoveByPatternAsync ( "sky*" ) ;
305
-
330
+ await WithKeyPrefix . RemoveByPatternAsync ( "sky*" ) ;
331
+
306
332
// exact
307
- await WithKeyPrefix . RemoveByPatternAsync ( "akey" ) ;
333
+ await WithKeyPrefix . RemoveByPatternAsync ( "akey" ) ;
308
334
309
335
var val9 = WithKeyPrefix . Get < string > ( "garden:pots:flowers" ) ;
310
336
var val10 = WithKeyPrefix . Get < string > ( "garden:pots:flowers:test" ) ;
@@ -314,7 +340,7 @@ public async Task RemoveByKeyPatternAsyncTest(string provider)
314
340
var val14 = WithKeyPrefix . Get < string > ( "sky:birds:bar" ) ;
315
341
var val15 = WithKeyPrefix . Get < string > ( "sky:birds:test:bar" ) ;
316
342
var val16 = WithKeyPrefix . Get < string > ( "akey" ) ;
317
-
343
+
318
344
Assert . False ( val9 . HasValue ) ;
319
345
Assert . False ( val10 . HasValue ) ;
320
346
Assert . True ( val11 . HasValue ) ;
0 commit comments