我之前的设置是单个Web服务器和单个数据库服务器.我正在使用nhibernate二级缓存来缓存内容,以避免大量调用进入数据库.这很有用,因为我正在使用这个组件
nhibernate.caches.syscache
并添加此代码以打开二级缓存(使用常规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();
我现在已迁移到具有多个Web服务器的新环境,我正在尝试了解其含义(我仍然有一个数据库服务器).
由于缓存之前存储在Web服务器上,现在看起来我在每个Web服务器上都有2个并行缓存,它们本身可能不同步并且可能导致过时更新等.