Reputation: 8357
I'm running a wpf app. With a nhibernate session you only have to query a table once and you can access it as many times as you like from cache.
But i like to cache some tables through the entire app because they almost never change, like users and usergroups. Should i use one session for the entire app or is there another solution?
Upvotes: 0
Views: 97
Reputation: 18961
Here's an excellent article on how to configure the 2nd level cache using FluentNHibernate
http://www.markhneedham.com/blog/2010/06/16/fluent-nhibernate-and-the-2nd-level-cache/
Upvotes: 1
Reputation: 7731
The cache that NHibernate provides as part of the session is referred to as the first level cache.
For caching things longer than the duration of a session, you need to take a look at the second level cache. NHibernate ships with implementations for several cache providers (memcached, SysCache, etc.).
Upvotes: 3