/// <summary> /// Called when an entity has been deleted /// </summary> public void OnEntityDeleted(TIdentity identity) { if (CacheEnabled) { _cachingStrategy.Delete(identity); } }
public void OnItemDeleted(TKey key, T item) { if (CacheEnabled) { _cachingStrategy.Delete(key, item); } }
public void TryFindResult_After_Delete_To_Partition_Should_Return_False() { var contact = new Contact() { ContactId = 1, Name = "Test User", ContactTypeId = 1 }; var specification = new Specification <Contact>(x => x.ContactTypeId == 1); IQueryOptions <Contact> queryOptions = new SortingOptions <Contact>("Name", true); CachingStrategy.SaveFindResult(specification, queryOptions, null, contact); CachingStrategy.TryFindResult(specification, queryOptions, null, out Contact result).ShouldBe(true); CachingStrategy.Delete(1, contact); CachingStrategy.TryFindResult(specification, queryOptions, null, out result).ShouldBe(false); CachingStrategy.SaveFindResult(specification, queryOptions, null, contact); // after saving the new results in the next generation then it should find it CachingStrategy.TryFindResult(specification, queryOptions, null, out result).ShouldBe(true); }