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

  • Home
  • SEARCH
  • 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 255333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:55:18+00:00 2026-05-11T21:55:18+00:00

I use custom developed ORM currently and am planing to move to nhibernate. Currently,

  • 0

I use custom developed ORM currently and am planing to move to nhibernate.

Currently, I use both L1 – session level caching and L2 – Application level caching.

Whenever an object is requested from L2 cache by L1 cache, it checks database for modified since last load, and loads only if it has been modified.

Can I do this with NHibernate. In short, caching does not hurt me as it always gets most recent data and saves me object creation and load times.

  • 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-11T21:55:18+00:00Added an answer on May 11, 2026 at 9:55 pm

    IMHO it’s pointless to have an L2 cache if it needs to hit the DB anyway. That’s precisely the entire point of caching, avoid hitting the DB as much as possible.

    AFAIK there is no caching strategy implemented like the one you describe, but NHibernate L2 caches are entirely pluggable so you could implement it. However, I wouldn’t, for the reasons I mentioned above.

    Getting outdated data is only an issue if there are other apps or other DALs hitting the same DB besides NHibernate. If that’s the case, you could use the SysCache2 implementation, which internally uses SqlCacheDependencies to invalidate cache regions when data in the underlying table changes.

    If it’s a single app running in a farm, use the Velocity provider.

    If there’s only one NHibernate app instance hitting the DB, any cache strategy will do and you don’t have to worry about getting outdated data.

    See also:

    • NHibernate docs about 2nd-level caching
    • NHibernate 2nd Level Cache @ NHibernate Forge
    • First and Second Level caching in NHibernate @ The NHibernate FAQ
    • Ayende’s posts about NHibernate caching
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need the ability to use custom locks at a session level (outside the
I want to use Custom URL Scheme to transfer data from application to other
I'm currently investigating the possibility to use custom attributes derived from ActionFilterAttribute. I want
Is there a mechanism to use Facebook Connect to authenticate via a custom developed
I could use some advice/help on a piece of software I've developed. The application
I have a custom developed webpart in Visual studio, and I want to use
I have developed MVC web app. Now, I want to use custom form authentication
We use custom type to represent Identifiers in our project. It has TypeConvertor attached
I want to use custom exception handling, for example instead of using (Exception ex)
Is it possible to use custom types in OpenCL kernel like gmp types (mpz_t,

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.