-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: How to define Syscache region expiry
PostPosted: Tue Feb 27, 2007 12:44 pm 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.