使用Castle ActiveRecord配置Memcache?

时间:2011-06-20 06:28:30

标签: nhibernate castle-activerecord

任何人都知道如何配置ActiveRecord / nhibernate应用程序以使用Memcache作为二级缓存?

1 个答案:

答案 0 :(得分:2)

ActiveRecord docs on second level cache configuration开始。然后,有关Memcached的具体信息,请参阅this question

你最终会得到一个与此类似的配置:

<activerecord>      
  <config>
    <add key="connection.driver_class" value="NHibernate.Driver.SqlClientDriver" />
    <add key="dialect" value="NHibernate.Dialect.MsSql2005Dialect" />
    <add key="connection.provider" value="NHibernate.Connection.DriverConnectionProvider" />
    <add key="connection.connection_string" value="Data Source=.;Initial Catalog=test;Integrated Security=SSPI" />    
    <add key="cache.provider_class" value="NHibernate.Caches.MemCache.MemCacheProvider, NHibernate.Caches.MemCache"/>
    <add key="cache.use_second_level_cache" value="true"/>
    <add key="cache.use_query_cache" value="true"/>
  </config>      
</activerecord>