NHibernate.Caches.MemCache web.config for cache expiration time
I am migrating to Nhibernate 2.0 GA but am having some problems setting the cache expiration in the memcached provider.
I see in the sources NHibernate.Caches.MemCache that there is a property to expire and a default for 300 seconds.
There are also properties for cache areas, but the config section handler doesn't seem to display them.
Is there a different cache expiration time set that is not provider specific -
Here is a functional web config section (no expiration settings).
<memcache>
<memcached host="127.0.0.1" port="11211"/>
<!-- or multiples -->
</memcache>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="show_sql">true</property>
<property name="connection.provider" >NHibernate.Connection.DriverConnectionProvider</property>
<property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<!-- <property name="hibernate.cache.provider_class" value="NHibernate.Caches.MemCache.MemCacheProvider,NHibernate.Caches.MemCache" /> -->
<property name="connection.connection_string">Data Source=stage2.ripple6.com;Initial Catalog=r6stage;User Id=sa;Password=mworld7650;Application Name=Hibernate;</property>
<property name="connection.isolation">ReadCommitted</property>
<property name="cache.use_second_level_cache">true</property>
<property name="cache.provider_class">NHibernate.Caches.MemCache.MemCacheProvider,NHibernate.Caches.MemCache</property>
<property name="default_schema" >r6stage.dbo</property>
</session-factory>
</hibernate-configuration>
+1
source to share
3 answers
Use expiration date.
<property name="expiration" >YOUR_INTERVAL_IN_SECONDS</property>
After that, when you start the application with logging, you can see:
NHibernate.Caches.MemCache.MemCacheClient: 20:57:55,762 DEBUG MemCacheClient:0 - using expiration of YOUR_INTERVAL_IN_SECONDS seconds
-1
source to share