3
3
namespace NRedisStack
4
4
{
5
5
6
- public class BloomCommands : IBloomCommands
6
+ public class BloomCommands : BloomCommandsAsync , IBloomCommands
7
7
{
8
8
IDatabase _db ;
9
- public BloomCommands ( IDatabase db )
9
+ public BloomCommands ( IDatabase db ) : base ( db )
10
10
{
11
11
_db = db ;
12
12
}
@@ -17,49 +17,24 @@ public bool Add(RedisKey key, RedisValue item)
17
17
return _db . Execute ( BloomCommandBuilder . Add ( key , item ) ) . ToString ( ) == "1" ;
18
18
}
19
19
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
-
26
20
/// <inheritdoc/>
27
21
public long Card ( RedisKey key )
28
22
{
29
23
return _db . Execute ( BloomCommandBuilder . Card ( key ) ) . ToLong ( ) ;
30
24
}
31
25
32
- /// <inheritdoc/>
33
- public async Task < long > CardAsync ( RedisKey key )
34
- {
35
- return ( await _db . ExecuteAsync ( BloomCommandBuilder . Card ( key ) ) ) . ToLong ( ) ;
36
- }
37
-
38
26
/// <inheritdoc/>
39
27
public bool Exists ( RedisKey key , RedisValue item )
40
28
{
41
29
return _db . Execute ( BloomCommandBuilder . Exists ( key , item ) ) . ToString ( ) == "1" ;
42
30
}
43
31
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
-
50
32
/// <inheritdoc/>
51
33
public BloomInformation Info ( RedisKey key )
52
34
{
53
35
return _db . Execute ( BloomCommandBuilder . Info ( key ) ) . ToBloomInfo ( ) ;
54
36
}
55
37
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
-
63
38
/// <inheritdoc/>
64
39
public bool [ ] Insert ( RedisKey key , RedisValue [ ] items , int ? capacity = null ,
65
40
double ? error = null , int ? expansion = null ,
@@ -68,74 +43,35 @@ public bool[] Insert(RedisKey key, RedisValue[] items, int? capacity = null,
68
43
return _db . Execute ( BloomCommandBuilder . Insert ( key , items , capacity , error , expansion , nocreate , nonscaling ) ) . ToBooleanArray ( ) ;
69
44
}
70
45
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
-
79
46
/// <inheritdoc/>
80
47
public bool LoadChunk ( RedisKey key , long iterator , Byte [ ] data )
81
48
{
82
49
return _db . Execute ( BloomCommandBuilder . LoadChunk ( key , iterator , data ) ) . OKtoBoolean ( ) ;
83
50
}
84
51
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
-
91
52
/// <inheritdoc/>
92
53
public bool [ ] MAdd ( RedisKey key , params RedisValue [ ] items )
93
54
{
94
55
return _db . Execute ( BloomCommandBuilder . MAdd ( key , items ) ) . ToBooleanArray ( ) ;
95
56
}
96
57
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
-
103
58
/// <inheritdoc/>
104
59
public bool [ ] MExists ( RedisKey key , RedisValue [ ] items )
105
60
{
106
61
return _db . Execute ( BloomCommandBuilder . MExists ( key , items ) ) . ToBooleanArray ( ) ;
107
62
}
108
63
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
-
115
64
/// <inheritdoc/>
116
65
public bool Reserve ( RedisKey key , double errorRate , long capacity ,
117
66
int ? expansion = null , bool nonscaling = false )
118
67
{
119
68
return _db . Execute ( BloomCommandBuilder . Reserve ( key , errorRate , capacity , expansion , nonscaling ) ) . OKtoBoolean ( ) ;
120
69
}
121
70
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
-
129
71
/// <inheritdoc/>
130
72
public Tuple < long , Byte [ ] > ScanDump ( RedisKey key , long iterator )
131
73
{
132
74
return _db . Execute ( BloomCommandBuilder . ScanDump ( key , iterator ) ) . ToScanDumpTuple ( ) ;
133
75
}
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
- }
140
76
}
141
77
}
0 commit comments