The second-level cache will be available as long as the SessionFactory is available if you choose and doesn't flush when the first-level cache flushes.
To enable the second-level cache just add something like this to your class mapping:
Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
default-access="nosetter.camelcase-underscore"
default-lazy="false">
<class name="Timesheet,AssemblyName"
table="Timesheet">
[b]<cache usage="read-write"/>[/b]
<id name="Id" access="property" unsaved-value="0" >
<column name="Id"/>
<generator class="native" />
</id>
If you dont want to use NHibernates secondlevel cache options, you can just choose a cache provider like Enterprise Library Caching Application Block and use that...simply place the object in the cache during a unit of work and it'll be there even after your ISession closes.
The only thing you need to be sure of is reattaching the object to the next ISession you are working with using either
Code:
Session.Update(object)
for entities who were persisted to the Db or
Code:
Session.Lock(object,LockMode.None)
for new entitites.