File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
src/ServiceStack.Redis/Generic
tests/ServiceStack.Redis.Tests/Generic Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -450,9 +450,11 @@ public void DeleteByIds(IEnumerable ids)
450
450
451
451
public void DeleteAll ( )
452
452
{
453
- var urnKeys = client . GetAllItemsFromSet ( this . TypeIdsSetKey ) ;
453
+ var ids = client . GetAllItemsFromSet ( this . TypeIdsSetKey ) ;
454
+ var urnKeys = ids . ConvertAll ( t => client . UrnKey < T > ( t ) ) ;
454
455
if ( urnKeys . Count > 0 )
455
456
{
457
+
456
458
this . RemoveEntry ( urnKeys . ToArray ( ) ) ;
457
459
this . RemoveEntry ( this . TypeIdsSetKey ) ;
458
460
}
Original file line number Diff line number Diff line change @@ -98,6 +98,27 @@ public void Can_ExpireAt()
98
98
Thread . Sleep ( 2000 ) ;
99
99
Assert . That ( RedisTyped . GetById ( "key" ) , Is . Null ) ;
100
100
}
101
+
102
+ [ Test ]
103
+ public void Can_Delete_All_Items ( )
104
+ {
105
+ var cachedRecord = new CacheRecord
106
+ {
107
+ Id = "key" ,
108
+ Children = {
109
+ new CacheRecordChild { Id = "childKey" , Data = "data" }
110
+ }
111
+ } ;
112
+
113
+ RedisTyped . Store ( cachedRecord ) ;
114
+
115
+ Assert . That ( RedisTyped . GetById ( "key" ) , Is . Not . Null ) ;
116
+
117
+ RedisTyped . DeleteAll ( ) ;
118
+
119
+ Assert . That ( RedisTyped . GetById ( "key" ) , Is . Null ) ;
120
+
121
+ }
101
122
}
102
123
103
124
}
You can’t perform that action at this time.
0 commit comments