Try Playground
Show / Hide Table of Contents

EF Core Extension Methods: Caching Options

Using the EF Core Extension Methods allows you to use some integral caching features provided by NCache. These caching options are encapsulated in the CachingOptions class provided by the EF Core Extension Methods. These caching options are used to populate the cache item before inserting it into the cache. These include a QueryIdentifier against the query result set, creating a DB dependency, and so on.

Note

This feature is also available in NCache Professional.

Prerequisites

To utilize the CachingOptions API for EF Core, include the following namespaces in your application:

  • Alachisoft.NCache.EntityFrameworkCore
  • Alachisoft.NCache.Runtime.Caching

Configure EF Core Query Identifier and DB Dependency

The following sample configures the cache with the EF Core QueryIdentifier CustomerEntity and creates a DB dependency on the cache items with Absolute Expiration.

var options = new CachingOptions
{
    QueryIdentifier = "CustomerEntity",
    CreateDbDependency = true,
    StoreAs = StoreAs.SeperateEntities,
    Priority = Runtime.CacheItemPriority.High
};

options.SetAbsoluteExpiration(DateTime.Now.AddSeconds(20));

See Also

.NET: Alachisoft.NCache.EntityFrameworkCore and Alachisoft.NCache.Runtime.Caching namespaces.

In This Article
  • Prerequisites
  • Configure EF Core Query Identifier and DB Dependency
  • See Also

Contact Us

PHONE

+1 (214) 764-6933   (US)

+44 20 7993 8327   (UK)

 
EMAIL

sales@alachisoft.com

support@alachisoft.com

NCache
  • NCache Enterprise
  • NCache Professional
  • Edition Comparison
  • NCache Architecture
  • Benchmarks
Download
Pricing
Try Playground

Deployments
  • Cloud (SaaS & Software)
  • On-Premises
  • Kubernetes
  • Docker
Technical Use Cases
  • ASP.NET Sessions
  • ASP.NET Core Sessions
  • Pub/Sub Messaging
  • Real-Time ASP.NET SignalR
  • Internet of Things (IoT)
  • NoSQL Database
  • Stream Processing
  • Microservices
Resources
  • Magazine Articles
  • Third-Party Articles
  • Articles
  • Videos
  • Whitepapers
  • Shows
  • Talks
  • Blogs
  • Docs
Customer Case Studies
  • Testimonials
  • Customers
Support
  • Schedule a Demo
  • Forum (Google Groups)
  • Tips
Company
  • Leadership
  • Partners
  • News
  • Events
  • Careers
Contact Us

  • EnglishChinese (Simplified)FrenchGermanItalianJapaneseKoreanPortugueseSpanish

  • Contact Us
  •  
  • Sitemap
  •  
  • Terms of Use
  •  
  • Privacy Policy
© Copyright Alachisoft 2002 - 2025. All rights reserved. NCache is a registered trademark of Diyatech Corp.
Back to top