/// <summary> /// Removes the serialized objects at the given cache keys from the cache. /// </summary> /// <param name="cacheKeys">The cache keys.</param> public void Remove(IEnumerable <string> cacheKeys) { // Sanitize if (cacheKeys == null) { throw new ArgumentNullException("cacheKeys"); } // Iterate all cache keys foreach (var cacheKey in cacheKeys) { _memCache.Remove(cacheKey); } }
public void HandleRequest(IRequestContext context) { var commandParams = context.Parameters.ToArray(); var key = _helpers.ToKey(commandParams[0]); var result = _cache.Remove(key) ? Encoding.ASCII.GetBytes("DELETED\r\n") : Encoding.ASCII.GetBytes("NOT_FOUND\r\n"); context.ResponseStream.WriteAsync(result, 0, result.Length); }
public void EvictEntry() { var count = _cache.Keys.Count(); if (count > 0) { var keyToEvict = _cache.Keys.ElementAt(_rng.Next(0, count)); _cache.Remove(keyToEvict); } }
public object Remove(string pointType = null) { var key = GetPointKey(pointType); return(_memCache.Remove(key)); }
/// <summary> /// Removes a byte array from the cache. /// </summary> /// <param name="key">The key of the byte array.</param> /// <returns>The byte array if the key was found in the cache, otherwise null.</returns> public byte[] Remove(string key) { return(_memCache.Remove(key)); }