Entity Framework Core Plus Query Cache - Cache Expiration
All common caching features like absolute expiration, sliding expiration, removed callback are supported.
// using Z.EntityFramework.Plus; // Don't forget to include this. var ctx = new EntitiesContext(); // Make the query expire after 2 hours of inactivity var options = new MemoryCacheEntryOptions() { SlidingExpiration = TimeSpan.FromHours(2)}; var states = ctx.States.FromCache(options);