Skip to content

Commit 4ddc1e8

Browse files
committed
Remove throw new NotImplementedException() in NullMemcachedClient
1 parent 97dd32b commit 4ddc1e8

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

Enyim.Caching/NullMemcachedClient.cs

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4+
using System.Net;
45
using System.Text;
56
using System.Threading.Tasks;
67
using Enyim.Caching.Memcached;
@@ -40,37 +41,37 @@ public CasResult<bool> Cas(StoreMode mode, string key, object value, TimeSpan va
4041

4142
public CasResult<bool> Cas(StoreMode mode, string key, object value, DateTime expiresAt, ulong cas)
4243
{
43-
throw new NotImplementedException();
44+
return new CasResult<bool>();
4445
}
4546

4647
public ulong Decrement(string key, ulong defaultValue, ulong delta)
4748
{
48-
throw new NotImplementedException();
49+
return default(ulong);
4950
}
5051

5152
public ulong Decrement(string key, ulong defaultValue, ulong delta, TimeSpan validFor)
5253
{
53-
throw new NotImplementedException();
54+
return default(ulong);
5455
}
5556

5657
public CasResult<ulong> Decrement(string key, ulong defaultValue, ulong delta, ulong cas)
5758
{
58-
throw new NotImplementedException();
59+
return new CasResult<ulong>();
5960
}
6061

6162
public ulong Decrement(string key, ulong defaultValue, ulong delta, DateTime expiresAt)
6263
{
63-
throw new NotImplementedException();
64+
return default(ulong);
6465
}
6566

6667
public CasResult<ulong> Decrement(string key, ulong defaultValue, ulong delta, TimeSpan validFor, ulong cas)
6768
{
68-
throw new NotImplementedException();
69+
return new CasResult<ulong>();
6970
}
7071

7172
public CasResult<ulong> Decrement(string key, ulong defaultValue, ulong delta, DateTime expiresAt, ulong cas)
7273
{
73-
throw new NotImplementedException();
74+
return new CasResult<ulong>();
7475
}
7576

7677
public void Dispose()
@@ -118,72 +119,72 @@ public async Task<T> GetValueAsync<T>(string key)
118119

119120
public IDictionary<string, CasResult<object>> GetWithCas(IEnumerable<string> keys)
120121
{
121-
throw new NotImplementedException();
122+
return new Dictionary<string, CasResult<object>>();
122123
}
123124

124125
public CasResult<object> GetWithCas(string key)
125126
{
126-
throw new NotImplementedException();
127+
return new CasResult<object>();
127128
}
128129

129130
public CasResult<T> GetWithCas<T>(string key)
130131
{
131-
throw new NotImplementedException();
132+
return new CasResult<T>();
132133
}
133134

134135
public ulong Increment(string key, ulong defaultValue, ulong delta)
135136
{
136-
throw new NotImplementedException();
137+
return default(ulong);
137138
}
138139

139140
public ulong Increment(string key, ulong defaultValue, ulong delta, TimeSpan validFor)
140141
{
141-
throw new NotImplementedException();
142+
return default(ulong);
142143
}
143144

144145
public CasResult<ulong> Increment(string key, ulong defaultValue, ulong delta, ulong cas)
145146
{
146-
throw new NotImplementedException();
147+
return new CasResult<ulong>();
147148
}
148149

149150
public ulong Increment(string key, ulong defaultValue, ulong delta, DateTime expiresAt)
150151
{
151-
throw new NotImplementedException();
152+
return default(ulong);
152153
}
153154

154155
public CasResult<ulong> Increment(string key, ulong defaultValue, ulong delta, TimeSpan validFor, ulong cas)
155156
{
156-
throw new NotImplementedException();
157+
return new CasResult<ulong>();
157158
}
158159

159160
public CasResult<ulong> Increment(string key, ulong defaultValue, ulong delta, DateTime expiresAt, ulong cas)
160161
{
161-
throw new NotImplementedException();
162+
return new CasResult<ulong>();
162163
}
163164

164165
public bool Prepend(string key, ArraySegment<byte> data)
165166
{
166-
throw new NotImplementedException();
167+
return false;
167168
}
168169

169170
public CasResult<bool> Prepend(string key, ulong cas, ArraySegment<byte> data)
170171
{
171-
throw new NotImplementedException();
172+
return new CasResult<bool>();
172173
}
173174

174175
public bool Remove(string key)
175176
{
176177
return true;
177178
}
178179

179-
public async Task<bool> RemoveAsync(string key)
180+
public Task<bool> RemoveAsync(string key)
180181
{
181-
return true;
182+
return Task.FromResult<bool>(false);
182183
}
183184

184185
public ServerStats Stats()
185186
{
186-
throw new NotImplementedException();
187+
return new ServerStats(new Dictionary<EndPoint, Dictionary<string, string>>());
187188
}
188189

189190
public ServerStats Stats(string type)
@@ -218,12 +219,14 @@ public bool Store(StoreMode mode, string key, object value, DateTime expiresAt)
218219

219220
public bool TryGet(string key, out object value)
220221
{
221-
throw new NotImplementedException();
222+
value = null;
223+
return false;
222224
}
223225

224226
public bool TryGetWithCas(string key, out CasResult<object> value)
225227
{
226-
throw new NotImplementedException();
228+
value = new CasResult<object>();
229+
return false;
227230
}
228231

229232
public void Add(string key, object value, int cacheSeconds)

0 commit comments

Comments
 (0)