Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3421550
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:06:58+00:00 2026-05-18T06:06:58+00:00

My scenario is pretty simple, I have 1 table with about 20 products that

  • 0

My scenario is pretty simple, I have 1 table with about 20 products that I would like to add to level 2 cache (SysCache) using Fluent NHibernate. I query this table 4 different ways so I figure I’d stick the whole thing in cache every so often and reduce the database hits.

My 4 queries are:

  1. All(start, max) for paging
  2. ByDate(date) for getting products before or after a certain date
  3. ById(id)
  4. ByName(name)

I have enabled SysCache in the fluent configuration using the code below and added the appropriate configuration to web.config.

MsSqlConfiguration.MsSql2008.Cache(c => c.ProviderClass<SysCacheProvider>()
                                         .UseQueryCache())

I added the following code to the ProductMap

Cache.ReadWrite().Region("testregion");

Now how do I proceed from here? Do I have to add SetCachable(true) to all my 4 queries? Is that the correct approach?

Part of me thinks that there should be a way to cache an All() query and then point the 4 above queries to use the cached All() to query against. Maybe my assumptions are dead wrong and every query does need to be added to cache separately using SetCachable(true) on a query level.

What is the correct approach to setup cache for this case?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T06:06:59+00:00Added an answer on May 18, 2026 at 6:06 am

    Query caching is enabled individually. There are no shortcuts built-in.

    Of course you could add an extension method, or use a base class that does that, but it’s really not worth it: wholesale caching rarely improves the performance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Use scenario is pretty simple: I have a desktop only application that could be
Pretty simple scenario. I have a web service that receives a byte array that
I have a pretty simple scenario using manual data operations with rad list view.
I have various methods that I would like to unit test using Visual Studio's
Its a pretty basic scenario. I have a table with a Geography datatype in
I have a scenario where I have a propertybag of key/values that would look
I have a pretty simple scenario. I have the following HTML: <h1>Hello</h1> <input type="button"
My issue is pretty simple. I have an application that should be executed automatically
I have the following seemingly simple scenario, however I'm still pretty new to NHibernate.
I have pretty simple scenario (MVVM) DataTemplate visuals should change based on data I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.