Skip to content

Commit dd07ad7

Browse files
committed
Implement GetWithCasAsync
1 parent b6f26f9 commit dd07ad7

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

Enyim.Caching/IMemcachedClient.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public interface IMemcachedClient : IDisposable
2828
CasResult<object> GetWithCas(string key);
2929
CasResult<T> GetWithCas<T>(string key);
3030
IDictionary<string, CasResult<object>> GetWithCas(IEnumerable<string> keys);
31+
Task<IDictionary<string, CasResult<object>>> GetWithCasAsync(IEnumerable<string> keys);
3132

3233
bool Append(string key, ArraySegment<byte> data);
3334
CasResult<bool> Append(string key, ulong cas, ArraySegment<byte> data);

Enyim.Caching/MemcachedClient.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,16 @@ public async Task<IDictionary<string, T>> GetAsync<T>(IEnumerable<string> keys)
975975

976976
public IDictionary<string, CasResult<object>> GetWithCas(IEnumerable<string> keys)
977977
{
978-
return PerformMultiGet<CasResult<object>>(keys, (mget, kvp) => new CasResult<object>
978+
return PerformMultiGet(keys, (mget, kvp) => new CasResult<object>
979+
{
980+
Result = this.transcoder.Deserialize(kvp.Value),
981+
Cas = mget.Cas[kvp.Key]
982+
});
983+
}
984+
985+
public async Task<IDictionary<string, CasResult<object>>> GetWithCasAsync(IEnumerable<string> keys)
986+
{
987+
return await PerformMultiGetAsync(keys, (mget, kvp) => new CasResult<object>
979988
{
980989
Result = this.transcoder.Deserialize(kvp.Value),
981990
Cas = mget.Cas[kvp.Key]

Enyim.Caching/NullMemcachedClient.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ public IDictionary<string, CasResult<object>> GetWithCas(IEnumerable<string> key
122122
return new Dictionary<string, CasResult<object>>();
123123
}
124124

125+
public async Task<IDictionary<string, CasResult<object>>> GetWithCasAsync(IEnumerable<string> keys)
126+
{
127+
return await Task.FromResult(new Dictionary<string, CasResult<object>>());
128+
}
129+
125130
public CasResult<object> GetWithCas(string key)
126131
{
127132
return new CasResult<object>();

0 commit comments

Comments
 (0)