I've been working on a WCF service that uses fluent and syscache2. I've pretty much read every article on SO regarding my current dilemma; I've had no luck.
I am trying to set the expiration time for my second-level cache. Whatever value I set seems to be ignored and the default value of 5 minutes is used to expire the cache.
Fluent configuration:
Note: contextClass is just a descriptor class holding values passed to the configuration.
var cfg = Fluently.Configure()
.Database(
MsSqlConfiguration.MsSql2008
.ConnectionString(c => c.Is(connectionString))
.ShowSql()
)
.Diagnostics(d => d.Enable())
.Cache(c => c
.UseQueryCache()
.ProviderClass(typeof(NHibernate.Caches.SysCache2.SysCacheProvider).AssemblyQualifiedName))
.Mappings(m => m
.FluentMappings
.AddFromAssembly(assembly))
.ExposeConfiguration(x =>
{
x.SetProperty(NHibernate.Cfg.Environment.CurrentSessionContextClass, contextClass.Id);
x.SetProperty(NHibernate.Cfg.Environment.PrepareSql, contextClass.PrepareSql); //set prepare_sql true/false
x.SetProperty(NHibernate.Cfg.Environment.CacheDefaultExpiration, contextClass.ExpireL2Cache); //set default expiration in seconds
});
I also have the app.config file set up as following:
<configSections>
<section name="syscache" type="NHibernate.Caches.SysCache2.SysCacheSection, NHibernate.Caches.SysCache2"/>
</configSections>
<syscache>
<cache expiration="600" priority="5" />
</syscache>
There was a variant of the app.config which had a syscache section that used regions but that didn't work either.
Anyone have any suggestions on ideas?
Thanks