I use Entity Framework Plus with FromCache option with EF6. My problem is that after adding a new item the cache that returned doesn't contain the item. Is it possible to "update" the cache automatically after a new item added?
Save a new policy:
db.policies.Add(policy);
db.SaveChanges();
Get the all policies:
database.policies.FromCache().ToList();
EF Plus has CacheItemPolicy but I have to supply SqlCommand for the class that I do not have as you can see in the example of saving an item.
Try the option IsAutoExpireCacheEnabled
for EF6
QueryCacheManager.IsAutoExpireCacheEnabled = true;
Fiddle: https://dotnetfiddle.net/3WHMGk
As soon as something is added/modified/deleted, all caches related to this DbSet will be clreared.