Hibernate version: 1.0.4
I've tried using the details explained in the section "20.1. How to use a cache?" of the documentation but the expriry doesn't seem to be respected.
After digging around in the test cases it looks like the docs are wrong and that expiration should actually be relativeExpiration but that doesn't seem to do anything either...
I need my objects to be cached for a maximum of 120 seconds - is there something I'm doing wrong?
Code:
<configSections>
<section
name="hibernate-configuration"
type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"
/>
<section
name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"
/>
<section
name="syscache"
type="NHibernate.Caches.SysCache.SysCacheSectionHandler,NHibernate.Caches.SysCache"
/>
</configSections>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.0">
<session-factory>
<property name="hibernate.connection.connection_string">Data Source=Machine;Database=DB;User ID=user;Password=pass;Persist Security Info=true;</property>
<property name="hibernate.connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="hibernate.dialect">NHibernate.Dialect.MsSql2000Dialect</property>
<property name="hibernate.connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="hibernate.connection.isolation">ReadCommitted</property>
<property name="hibernate.default_schema">DB.dbo</property>
<property name="hibernate.query.substitutions">true 1, false 0</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.cache.provider_class">NHibernate.Caches.SysCache.SysCacheProvider, NHibernate.Caches.SysCache</property>
<mapping assembly="Core"/>
<class-cache class="Core.User, Core" region="User" usage="read-write"/>
<collection-cache collection="Core.User.Roles" region="User.Roles" usage="read-write" />
<collection-cache collection="Core.User.Permissions" region="User.Permissions" usage="read-write" />
</session-factory>
</hibernate-configuration>
<syscache>
<cache region="User" relativeExpiration="120" priority="3" />
<cache region="User.Roles" relativeExpiration="120" priority="3" />
<cache region="User.Permissions" relativeExpiration="120" priority="3" />
</syscache>
Cheers,
Symon.