Exemplo n.º 1
0
        /// <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);
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 5
0
 /// <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));
 }