【问题标题】:EnterpriseLibrary Caching in Load Balance负载均衡中的 EnterpriseLibrary 缓存
【发布时间】: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


    【解决方案1】:

    Enterprise Library 不支持开箱即用的分布式多服务器缓存解决方案。来自Chapter 5 of the Developer's Guide:

    开箱即用,缓存应用程序块不提供 跨多个服务器的分布式缓存所需的功能。

    根据您要执行的操作,我会查看Windows Server AppFabric Caching Services。

    Windows Server AppFabric 提供分布式内存应用程序 用于开发可扩展、可用和 高性能应用程序。

    【讨论】:

    • 谢谢,请问有没有办法让企业库分布式多服务器缓存?并且您是否有没有开箱即用的分布式多服务器缓存解决方案的文档列表? -谢谢
    • @TarekEl-Mallah,我很确定您可以使用 Enterprise Library 实现分布式多服务器缓存。但是,既然有有开箱即用的解决方案,为什么还要进行所有这些开发和测试呢?
    • 谢谢,“Windows Server AppFabric”是免费使用还是我必须购买的东西?是否有代码示例
    • Windows Server AppFabric 是免费的(不要与 Azure AppFabric 混淆)。去their homepage——那里有很多资源。另请参阅this 示例。
    猜你喜欢
    • 2013-01-04
    • 2021-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-27
    • 2018-09-09
    • 2023-04-05
    相关资源
    最近更新 更多