저는 며칠 동안이 일을 해왔습니다. 나는 Memcached 서버와 NHContrib의 공급자와 함께 두 번째 수준의 캐시를 사용하도록 내 웹/앱 구성을 구성했습니다. 나는 아직 테스트에서 예외를 얻지는 않는다. cacheable = true를 설정 한 쿼리에 대해 캐시를 사용하지 않는다는 것을 알 수있다. 공급자를 NHibernate.Cache.HashtableCacheProvider로 전환하고 테스트가 예상대로 작동하는지 확인하십시오. 여기 Memcached NHibernate 제공자가 작동하지 않습니다.
내가 만료 속성을 다른 사람 (SysCache) 같은 공급자 구성에 세션 공장 수준에서 memcache에 공급자에 대한 설정 안된다고 생각 나는<configuration>
<configSections>
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler,NHibernate" />
<section name="memcache" type="NHibernate.Caches.MemCache.MemCacheSectionHandler,NHibernate.Caches.MemCache" />
</configSections>
<memcache>
<memcached host="192.168.215.60" port="11211" />
</memcache>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">
NHibernate.Connection.DriverConnectionProvider
</property>
<property name="dialect">
MT.Core.Persistence.Dialect, MT.Core
</property>
<property name="connection.driver_class">
NHibernate.Driver.SqlClientDriver
</property>
<property name="connection.connection_string">
Server=192.168.1.1;Initial Catalog=Test;User ID=TestUser;Password=fakepassword;
</property>
<property name="show_sql">true</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory,NHibernate.ByteCode.LinFu</property>
<property name="cache.provider_class">NHibernate.Caches.MemCache.MemCacheProvider,NHibernate.Caches.MemCache</property>
<!--<property name="cache.provider_class">NHibernate.Cache.HashtableCacheProvider</property>-->
<property name="cache.use_second_level_cache">true</property>
<property name="cache.use_query_cache">true</property>
</session-factory>
</hibernate-configuration>
</configuration>
cache.default_expiration에 대한 세션 팩토리 아래에 속성이 있지만 이것을 추가해도 캐시가 작동하지 않습니다. 나는 여전히 데이터베이스에서 두 개의 쿼리를 볼 수있는 테스트를 볼 수 있습니다. – CountCet
나는 memcache를 사용하기 때문에 만료를 시도했는데 그것이 나를 위해 일하고있다. – MatthieuGD
예 예 정확한 속성을 추가했는데 예외가 발생하고 예외가 발생했습니다. 나는 Nhibernate 2.1.2에 있습니다. –
CountCet