It would be a great to have NH Second-Level cache utilize the new ASP.Net 2.0 SQL Cache Dependency feature. By this, we would be able to place an NH entity in the Second Level cache and keep it there until the underlaying table/row is changed. Using this in plain ASP.Net (without NH) gives an excellent caching scheme for lists of common data (phone area codes, lookup values and other data which is frequently used but infrequently changed. It seems like a must for an ORM system that's targeted to be used in ASP.Net Web applications.
Thinking out loud: (I'm not very farmiliar with the second-level cache provider architecture of NH so maybe I'm way off ) If when NH passes an object/entity to the cache provider the cache provider knows about the cached object's class and assembly, then it should be simple for the cache provider to use NH's meta API to look up the underlaying table/s for the cached entity and just store the item in the ASP.Net cache with an SQL dependancy on the underlaying table.
Environment
None
Activity
AdamA April 3, 2007 at 12:22 PM
Can this be closed with the inclusion of NHibernate.Caches.SysChache2?
Tupshin Harper September 21, 2006 at 12:16 PM
What this would do would allow you to have writers to the database that aren't going through NHibernate and have NHibernate caches not reflect out of date information. In our case, we are using a "clustered" design with a database on each server with data synchronization happening at a sql replication level. With cache invalidation, updates happening on any machine will automatically trigger appropriate cache invalidation on all other machines.
AdamA June 25, 2006 at 2:07 PM
I too am unfamiliar with NHibernate Second Level caching, but it seems like there would be less cache refreshes using NHibernates model. I would assume an item stays in cache until it is modified as opposed to an item staying in cache until the underlying table is modified. NHibernate seems to be much more granular than ASP.Net.... It could also cause havoc for large object graphs if a base table changes then the entire graph of cached objects would have to be evicted.
It would be a great to have NH Second-Level cache utilize the new ASP.Net 2.0 SQL Cache Dependency feature.
By this, we would be able to place an NH entity in the Second Level cache and keep it there until the underlaying table/row is changed.
Using this in plain ASP.Net (without NH) gives an excellent caching scheme for lists of common data (phone area codes, lookup values and other data which is frequently used but infrequently changed. It seems like a must for an ORM system that's targeted to be used in ASP.Net Web applications.
Thinking out loud:
(I'm not very farmiliar with the second-level cache provider architecture of NH so maybe I'm way off )
If when NH passes an object/entity to the cache provider the cache provider knows about the cached object's class and assembly, then it should be simple for the cache provider to use NH's meta API to look up the underlaying table/s for the cached entity and just store the item in the ASP.Net cache with an SQL dependancy on the underlaying table.