【发布时间】:2011-12-09 14:58:14
【问题描述】:
我可以在负载平衡服务器中使用 Microsoft 企业库缓存吗? 我的情况是我有一个位于 2 个负载平衡服务器中的 Web 服务,并且我使用数据库缓存“backingStores”,其配置如下
<cachingConfiguration defaultCacheManager="Cache Manager">
<cacheManagers>
<add name="Cache Manager" type="Microsoft.Practices.EnterpriseLibrary.Caching.CacheManager, Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" expirationPollFrequencyInSeconds="60" maximumElementsInCacheBeforeScavenging="1000" numberToRemoveWhenScavenging="10" backingStoreName="MyDataCacheStorage11"/>
</cacheManagers>
<backingStores>
<add name="MyDataCacheStorage11" type="Microsoft.Practices.EnterpriseLibrary.Caching.Database.DataBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching.Database, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" encryptionProviderName="" databaseInstanceName="EntLib1ConnectionString111" partitionName="CAPwiki Cache"/>
<add type="Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.NullBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="NullBackingStore"/>
</backingStores>
</cachingConfiguration>
当我使用 server1 的键“_testorderstatus3”设置缓存并尝试从 server2 获取它时,它返回 Null 值!!!
当我从 server1 使用相同的键设置值并从 server2 再次设置时,我检查了数据库,我发现它设置了 2 次,如下所示
对此有任何想法吗?我需要设置并进入两台服务器。
谢谢
【问题讨论】:
标签: asp.net caching enterprise-library database-caching enterprise-library-4.1