public override CacheModificationResult AddOrChange <T>(string key, CacheValueOf <T> cacheObject) { if (_useInMemoryCache) { _innerCacheProvider.AddOrChange(key, cacheObject); } var existing = GetCacheEntry(key, true); try { if (existing != null) { _indexController.QueueRemoveWhere(new Term("CacheKey", key)); } var doc = new Document(); ModifyDocument(doc, key, cacheObject); LogHelper.TraceIfEnabled <CacheProvider>("Queueing an item to the index"); _indexController.QueueAdd(doc); return(new CacheModificationResult(existing != null, existing == null)); } finally { _removalCache.Remove(key); } }