I've got a web application that is 99% read-only, with a separate service that updates the database at specific intervals (like every 10 minutes). How can this service tell the application to invalidate it's second-level cache? Is it actually important? (I don't actually care if I have too much stale data) If I don't invalidate the cache how much time is needed to the records to get updated (if using SysCache)
NHibernate second-level cache with external updates
1.8k views Asked by SztupY At
2
There are 2 answers
0
On
If you are OK with the possibility of having some stale data, just set the default expiration to something you are comfortable with, and you'll be set.
Example:
<property name="cache.default_expiration">120</property>
This sets the default expiration to two minutes, so you'll never see stale data older than that.
You can manually dispose your 2nd level cache for a specific entity, entity type or a collection.
From http://knol.google.com/k/fabio-maulo/nhibernate-chapter-16-improving/1nr4enxv3dpeq/19#