leo*_*ora 8 nhibernate asp.net-mvc load-balancing fluent-nhibernate second-level-cache
我之前的设置是单个Web服务器和单个数据库服务器.我正在使用nhibernate二级缓存来缓存内容,以避免大量调用进入数据库.这很有用,因为我正在使用这个组件
nhibernate.caches.syscache
Run Code Online (Sandbox Code Playgroud)
并添加此代码以打开二级缓存(使用常规syscache提供程序):
return configuration
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<ApplicationMap>().Conventions.Add(typeof(Conventions)))
.ExposeConfiguration(
c => {
c.SetProperty("proxyfactory.factory_class", proxyFactory);
c.SetProperty("cache.provider_class", "NHibernate.Caches.SysCache.SysCacheProvider, NHibernate.Caches.SysCache");
c.SetProperty("cache.use_second_level_cache", "true");
c.SetProperty("cache.use_query_cache", "true");
c.SetProperty("expiration", "86400");
})
.BuildSessionFactory();
Run Code Online (Sandbox Code Playgroud)
我现在已迁移到具有多个Web服务器的新环境,并且我正在尝试了解其含义(我仍然有一个数据库服务器).
由于缓存之前存储在Web服务器上,现在看起来我在每个Web服务器上都有2个并行缓存,它们本身可能不同步并且可能导致过时更新等.
获得之前缓存的好处的最佳解决方案是什么,还可以利用此新设置提供的Web服务器负载平衡的弹性?
归档时间: |
|
查看次数: |
1903 次 |
最近记录: |