Caching

We have briefly touched the topic of caching in multiple places earlier. Caching support in NHibernate is more extensive than most of the frameworks that I have come across so far. Following are the three different types of caches available in NHibernate:

  • Session level cache: ISession caches every entity that it loads from the database. This is default behavior and cannot be changed or turned off.
  • Query cache: At individual query level, you can specify if the output of that query needs to be cached. This cache is shared across sessions.
  • Second level cache: This is similar to session level cache but it is shared across all the sessions in a session factory. Due to its shared nature, this cache is most complex of all and comes with settings ...

Get Learning NHibernate 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.