How to configure SysCache on Fluent NHibernate?

Using this, I can tell Fluent NHibernate to use SysCache as a second-level cache provider:

MsSqlConfiguration.MsSql2008.ShowSql().ConnectionString(x =>
            {
                x.Server(@"localhost\ANDREPC");
                x.Database("mydb");
                x.TrustedConnection();
            }).Cache(c => c.ProviderClass<SysCacheProvider>().UseQueryCache())

In addition, SysCache configurations must be hosted on Web.Config:

<configuration>
 <configSections>
  <section name="syscache" type="NHibernate.Caches.SysCache.SysCacheSectionHandler,NHibernate.Caches.SysCache" />
 </configSections>

 <syscache>
  <cache region="foo" expiration="500" priority="4" />
  <cache region="bar" expiration="300" priority="3" />
 </syscache>
</configuration>

Now what? What do these regions mean? How to associate a region with a type? How to make it work? My jMeter checks sugest that after configuring above my application turned out 7% slower than before. I need to understand SysCache and learn how to proceed with the setup.

Thank.

PS: The official SysCache documentation is here and it is inexplicable

+3
source share
1 answer

, , , L2 - , , E.G. session.Get session.Load. ICriteria .., , , . .

ICriteria criteria = Session.CreateCriteria( ).SetCacheable( true ).SetCacheRegion( "SomeNameHere" );

- . , , . /, "" "".

Cache . -

Cache.ReadWrite( ).IncludeAll( ) ;

, , , , , , , , , 100 , 100 . , .

, .

+3

Source: https://habr.com/ru/post/1770018/


All Articles