title: Do not expire cached item in IMemoryCache implementation
body: <p>Since <code>IMemoryCache</code> does not give too much info about the cached items I was thinking to implement something custom in order to keep some data about items in the cache like the <code>key</code>, <code>AbsoluteExpiration</code> properties etc.</p>
  
  <p>Here is my implementation of <code>IMemoryCache</code>:</p>
  
  <pre><code>public class MemoryCacheService : IMemoryCache
  {
      private readonly MemoryCache _memoryCache;
      private readonly List&lt;CacheItemRelevantData&gt; _allKeys;
      private readonly string AllKeys = "___All__Keys___";
      public MemoryCacheService()
      {
          _memoryCache = new MemoryCache(new MemoryCacheOptions());
          _allKeys = new List&lt;CacheItemRelevantData&gt;();
          _memoryCache.Set(AllKeys, _allKeys, new MemoryCacheEntryOptions
          {
              AbsoluteExpiration = DateTimeOffset.MaxValue
          });
      }
  
      public void Dispose()
      {
          _memoryCache.Dispose();
      }
  
      public bool TryGetValue(object key, out object value)
      {
          return _memoryCache.TryGetValue(key, out value);
      }
  
      public ICacheEntry CreateEntry(object key)
      {
          var entry = _memoryCache.CreateEntry(key);
          entry.RegisterPostEvictionCallback((o, v, reason, state) =&gt;
          {
              if (reason.In(EvictionReason.Capacity, EvictionReason.Expired, EvictionReason.TokenExpired))
              {
                  var item = _allKeys.FirstOrDefault(x =&gt; x.Key.ToString() == o.ToString());
                  if (item != null)
                  {
                      _allKeys.Remove(item);
                  }
              }
          });
          if (!_allKeys.Select(x =&gt; x.Key).Contains(key))
          {
              _allKeys.Add(new CacheItemRelevantData
              {
                  Key = entry.Key,
                  AbsoluteExpiration = entry.AbsoluteExpiration,
                  Priority = entry.Priority,
                  AbsoluteExpirationRelativeToNow = entry.AbsoluteExpirationRelativeToNow,
                  Size = entry.Size
              });
          }
          return entry;
      }
  
      public void Remove(object key)
      {
          var entry = _allKeys.FirstOrDefault(x =&gt; x.Key.ToString() == key.ToString());
          if (entry != null)
          {
              _allKeys.Remove(entry);
          }
  
          _memoryCache.Remove(key);
      }
  }
  </code></pre>
  
  <p>But since <code>_allKeys</code> is created to store the relevant data about cached items I dont want it to expire.</p>
  
  <p>Is there any way to set expire time to none or something similar and the <code>_allKeys</code> list will remain in cache forever ?</p>