选择您的 Cookie 首选项

我们使用必要 Cookie 和类似工具提供我们的网站和服务。我们使用性能 Cookie 收集匿名统计数据,以便我们可以了解客户如何使用我们的网站并进行改进。必要 Cookie 无法停用,但您可以单击“自定义”或“拒绝”来拒绝性能 Cookie。

如果您同意,AWS 和经批准的第三方还将使用 Cookie 提供有用的网站功能、记住您的首选项并显示相关内容,包括相关广告。要接受或拒绝所有非必要 Cookie,请单击“接受”或“拒绝”。要做出更详细的选择,请单击“自定义”。

使用适用于.NET 的 ElastiCache 群集客户端

聚焦模式
使用适用于.NET 的 ElastiCache 群集客户端 - Amazon ElastiCache

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

注意

自 2022 年 5 月起, ElastiCache .NET 集群客户端已被弃用。

的.NET 客户端 ElastiCache 是开源的,网址为https://github.com/awslabs/elasticache-cluster-config-net

.NET 应用程序通常会从其配置文件中获取其配置。下面是一个应用程序配置文件示例。

<?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <section name="clusterclient" type="Amazon.ElastiCacheCluster.ClusterConfigSettings, Amazon.ElastiCacheCluster" /> </configSections> <clusterclient> <!-- the hostname and port values are from step 1 above --> <endpoint hostname="mycluster.fnjyzo.cfg.use1.cache.amazonaws.com" port="11211" /> </clusterclient> </configuration>

下面的 C# 程序演示了如何使用 ElastiCache 集群客户端连接到集群配置终端节点并将数据项添加到缓存中。借助 Auto Discovery,程序将在没有任何进一步干预的情况下连接至集群中的所有节点。

// ***************** // Sample C# code to show how to integrate with the Amazon ElastiCcache Auto Discovery feature. using System; using Amazon.ElastiCacheCluster; using Enyim.Caching; using Enyim.Caching.Memcached; public class DotNetAutoDiscoveryDemo { public static void Main(String[] args) { // instantiate a new client. ElastiCacheClusterConfig config = new ElastiCacheClusterConfig(); MemcachedClient memClient = new MemcachedClient(config); // Store the data for 3600 seconds (1hour) in the cluster. // The client will decide which cache host will store this item. memClient.Store(StoreMode.Set, 3600, "This is the data value."); } // end Main } // end class DotNetAutoDiscoverDemo
隐私网站条款Cookie 首选项
© 2025, Amazon Web Services, Inc. 或其附属公司。保留所有权利。