Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Enyim.Caching/IMemcachedClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public interface IMemcachedClient : IDisposable

bool Remove(string key);
Task<bool> RemoveAsync(string key);
Task<bool> RemoveMultiAsync(params string[] keys);

void FlushAll();
Task FlushAllAsync();
Expand Down
35 changes: 29 additions & 6 deletions Enyim.Caching/MemcachedClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1055,12 +1055,35 @@ public bool Remove(string key)
return ExecuteRemove(key).Success;
}

//TODO: Not Implement
public async Task<bool> RemoveAsync(string key)
{
return (await ExecuteRemoveAsync(key)).Success;
}

public async Task<bool> RemoveMultiAsync(params string[] keys)
{
if (keys.Length > 0)
{
var tasks = new Task<IRemoveOperationResult>[keys.Length];

for (var i = 0; i < keys.Length; i++)
{
tasks[i] = ExecuteRemoveAsync(keys[i]);
}

await Task.WhenAll(tasks);

foreach (var task in tasks)
{
if (!(await task).Success) return false;
}

return true;
}

return false;
}

/// <summary>
/// Retrieves multiple items from the cache.
/// </summary>
Expand Down Expand Up @@ -1416,20 +1439,20 @@ void IDistributedCache.Remove(string key)

#region [ License information ]
/* ************************************************************
*
*
* Copyright (c) 2010 Attila Kisk? enyim.com
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* ************************************************************/
#endregion
5 changes: 5 additions & 0 deletions Enyim.Caching/MemcachedClientT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ public Task<bool> RemoveAsync(string key)
return _memcachedClient.RemoveAsync(key);
}

public Task<bool> RemoveMultiAsync(params string[] keys)
{
return _memcachedClient.RemoveMultiAsync(keys);
}

public bool Replace(string key, object value, int cacheSeconds)
{
return _memcachedClient.Replace(key, value, cacheSeconds);
Expand Down
7 changes: 6 additions & 1 deletion Enyim.Caching/NullMemcachedClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,12 @@ public bool Remove(string key)

public Task<bool> RemoveAsync(string key)
{
return Task.FromResult<bool>(false);
return Task.FromResult(false);
}

public Task<bool> RemoveMultiAsync(params string[] keys)
{
return Task.FromResult(false);
}

public ServerStats Stats()
Expand Down