33namespace NRedisStack
44{
55
6- public class BloomCommands : IBloomCommands
6+ public class BloomCommands : BloomCommandsAsync , IBloomCommands
77 {
88 IDatabase _db ;
9- public BloomCommands ( IDatabase db )
9+ public BloomCommands ( IDatabase db ) : base ( db )
1010 {
1111 _db = db ;
1212 }
@@ -17,49 +17,24 @@ public bool Add(RedisKey key, RedisValue item)
1717 return _db . Execute ( BloomCommandBuilder . Add ( key , item ) ) . ToString ( ) == "1" ;
1818 }
1919
20- /// <inheritdoc/>
21- public async Task < bool > AddAsync ( RedisKey key , RedisValue item )
22- {
23- return ( await _db . ExecuteAsync ( BloomCommandBuilder . Add ( key , item ) ) ) . ToString ( ) == "1" ;
24- }
25-
2620 /// <inheritdoc/>
2721 public long Card ( RedisKey key )
2822 {
2923 return _db . Execute ( BloomCommandBuilder . Card ( key ) ) . ToLong ( ) ;
3024 }
3125
32- /// <inheritdoc/>
33- public async Task < long > CardAsync ( RedisKey key )
34- {
35- return ( await _db . ExecuteAsync ( BloomCommandBuilder . Card ( key ) ) ) . ToLong ( ) ;
36- }
37-
3826 /// <inheritdoc/>
3927 public bool Exists ( RedisKey key , RedisValue item )
4028 {
4129 return _db . Execute ( BloomCommandBuilder . Exists ( key , item ) ) . ToString ( ) == "1" ;
4230 }
4331
44- /// <inheritdoc/>
45- public async Task < bool > ExistsAsync ( RedisKey key , RedisValue item )
46- {
47- return ( await _db . ExecuteAsync ( BloomCommandBuilder . Exists ( key , item ) ) ) . ToString ( ) == "1" ;
48- }
49-
5032 /// <inheritdoc/>
5133 public BloomInformation Info ( RedisKey key )
5234 {
5335 return _db . Execute ( BloomCommandBuilder . Info ( key ) ) . ToBloomInfo ( ) ;
5436 }
5537
56- /// <inheritdoc/>
57- public async Task < BloomInformation > InfoAsync ( RedisKey key )
58- {
59- var info = ( await _db . ExecuteAsync ( BloomCommandBuilder . Info ( key ) ) ) ;
60- return info . ToBloomInfo ( ) ;
61- }
62-
6338 /// <inheritdoc/>
6439 public bool [ ] Insert ( RedisKey key , RedisValue [ ] items , int ? capacity = null ,
6540 double ? error = null , int ? expansion = null ,
@@ -68,74 +43,35 @@ public bool[] Insert(RedisKey key, RedisValue[] items, int? capacity = null,
6843 return _db . Execute ( BloomCommandBuilder . Insert ( key , items , capacity , error , expansion , nocreate , nonscaling ) ) . ToBooleanArray ( ) ;
6944 }
7045
71- /// <inheritdoc/>
72- public async Task < bool [ ] > InsertAsync ( RedisKey key , RedisValue [ ] items , int ? capacity = null ,
73- double ? error = null , int ? expansion = null ,
74- bool nocreate = false , bool nonscaling = false )
75- {
76- return ( await _db . ExecuteAsync ( BloomCommandBuilder . Insert ( key , items , capacity , error , expansion , nocreate , nonscaling ) ) ) . ToBooleanArray ( ) ;
77- }
78-
7946 /// <inheritdoc/>
8047 public bool LoadChunk ( RedisKey key , long iterator , Byte [ ] data )
8148 {
8249 return _db . Execute ( BloomCommandBuilder . LoadChunk ( key , iterator , data ) ) . OKtoBoolean ( ) ;
8350 }
8451
85- /// <inheritdoc/>
86- public async Task < bool > LoadChunkAsync ( RedisKey key , long iterator , Byte [ ] data )
87- {
88- return ( await _db . ExecuteAsync ( BloomCommandBuilder . LoadChunk ( key , iterator , data ) ) ) . OKtoBoolean ( ) ;
89- }
90-
9152 /// <inheritdoc/>
9253 public bool [ ] MAdd ( RedisKey key , params RedisValue [ ] items )
9354 {
9455 return _db . Execute ( BloomCommandBuilder . MAdd ( key , items ) ) . ToBooleanArray ( ) ;
9556 }
9657
97- /// <inheritdoc/>
98- public async Task < bool [ ] > MAddAsync ( RedisKey key , params RedisValue [ ] items )
99- {
100- return ( await _db . ExecuteAsync ( BloomCommandBuilder . MAdd ( key , items ) ) ) . ToBooleanArray ( ) ;
101- }
102-
10358 /// <inheritdoc/>
10459 public bool [ ] MExists ( RedisKey key , RedisValue [ ] items )
10560 {
10661 return _db . Execute ( BloomCommandBuilder . MExists ( key , items ) ) . ToBooleanArray ( ) ;
10762 }
10863
109- /// <inheritdoc/>
110- public async Task < bool [ ] > MExistsAsync ( RedisKey key , RedisValue [ ] items )
111- {
112- return ( await _db . ExecuteAsync ( BloomCommandBuilder . MExists ( key , items ) ) ) . ToBooleanArray ( ) ;
113- }
114-
11564 /// <inheritdoc/>
11665 public bool Reserve ( RedisKey key , double errorRate , long capacity ,
11766 int ? expansion = null , bool nonscaling = false )
11867 {
11968 return _db . Execute ( BloomCommandBuilder . Reserve ( key , errorRate , capacity , expansion , nonscaling ) ) . OKtoBoolean ( ) ;
12069 }
12170
122- /// <inheritdoc/>
123- public async Task < bool > ReserveAsync ( RedisKey key , double errorRate , long capacity ,
124- int ? expansion = null , bool nonscaling = false )
125- {
126- return ( await _db . ExecuteAsync ( BloomCommandBuilder . Reserve ( key , errorRate , capacity , expansion , nonscaling ) ) ) . OKtoBoolean ( ) ;
127- }
128-
12971 /// <inheritdoc/>
13072 public Tuple < long , Byte [ ] > ScanDump ( RedisKey key , long iterator )
13173 {
13274 return _db . Execute ( BloomCommandBuilder . ScanDump ( key , iterator ) ) . ToScanDumpTuple ( ) ;
13375 }
134-
135- /// <inheritdoc/>
136- public async Task < Tuple < long , Byte [ ] > > ScanDumpAsync ( RedisKey key , long iterator )
137- {
138- return ( await _db . ExecuteAsync ( BloomCommandBuilder . ScanDump ( key , iterator ) ) ) . ToScanDumpTuple ( ) ;
139- }
14076 }
14177}
0 commit comments