一个数据库,两个应用程序,第二级缓存和NHibernate [英] One database, two applications, 2nd-level caching and NHibernate

查看:62
本文介绍了一个数据库,两个应用程序,第二级缓存和NHibernate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用NHibernate设置缓存时,如果我有两个在不同服务器上运行的应用程序,但只有一个数据库,我需要知道些什么.通常,表依赖性是否足以确保不会出现奇怪的缓存问题?如果是这样,我应该看哪种轮询时间?

What do I need to know when setting up caching using NHibernate, in the case that I have two applications running on different servers, but only one database. Are table dependencies generally sufficient to make sure that weird caching problems don't arise? If so, what sort of polltime should I look at?

推荐答案

为了使nhibernate检查并发问题,您可以向您的实体添加字段.这将导致nhibernate在尝试更新已被其他人修改的实体时引发并发异常.

well in order for nhibernate to check for concurrency issues you can add a field to your entities. That will cause nhibernate to throw a concurrency exception when trying to update an entity that has been modified by someone else.

如果要将二级缓存与多个服务器一起使用,我建议使用nhibernate二级缓存的分布式实现,例如NCache: http://www.alachisoft.com/ncache/nhibernate_index.html

If you want to use the second level cache with multiple servers I can recommend a distributed implementation of the nhibernate second level cache, for example NCache: http://www.alachisoft.com/ncache/nhibernate_index.html

这篇关于一个数据库,两个应用程序,第二级缓存和NHibernate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆