Reputation: 439
A excerpt from http://nhibernate.hibernatingrhinos.com/28/first-and-second-level-caching-in-nhibernate
"The life time of the second level cache is tied to the session factory and not to an individual session. Once an entity is loaded by its unique id and the second level cache is active the entity is available for all other sessions (of the same session factory)"
If the above is true and you have a web farm I think the following is true
1) there will be a SessionFactory per application (each web server in my case) 2) there will be a distinct 2nd level cache for each web server 3) data loaded in to the 2nd level cache for server A cannot be utilised by server B
Am I correct?
Upvotes: 1
Views: 1109
Reputation: 123861
As said in article you mentioned First and Second Level caching in NHibernate:
NHibernate is design as an enterprise OR/M product, and as such, it has very good support for running in web farms scenarios. This support include running along side with distributed caches, including immediate farm wide updates. NHibernate goes to great lengths to ensure cache consistency in these scenarios...
If distributed cache is used, immediate updates are raised around all servers (e.g. to drop off stale data)
see also:
Upvotes: 1