Amazon DynamoDB
开发人员指南 (API 版本 2012-08-10)
AWS 文档中描述的 AWS 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 AWS 服务入门

05-Scan-Test.cs

05-Scan-Test.cs 程序在 Scan 上执行 TryDaxTable 操作。

/** * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * This file is licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. A copy of * the License is located at * * http://aws.amazon.com/apache2.0/ * * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ using Amazon.Runtime; using Amazon.DAX; using Amazon.DynamoDBv2.Model; using System.Collections.Generic; using System; using Amazon.DynamoDBv2; using Amazon; namespace ClientTest { class Program { static void Main(string[] args) { String hostName = args[0].Split(':')[0]; int port = Int32.Parse(args[0].Split(':')[1]); Console.WriteLine("Using DAX client - hostname=" + hostName + ", port=" + port); var clientConfig = new DaxClientConfig(hostName, port) { AwsCredentials = FallbackCredentialsFactory.GetCredentials( }; var client = new ClusterDaxClient(clientConfig); var tableName = "TryDaxTable"; var iterations = 5; var startTime = DateTime.Now; for (var i = 0; i < iterations; i++) { var request = new ScanRequest() { TableName = tableName }; var response = client.ScanAsync(request).Result; Console.WriteLine(i + ": Scan succeeded"); } var endTime = DateTime.Now; TimeSpan timeSpan = endTime - startTime; Console.WriteLine("Total time: " + (int)timeSpan.TotalMilliseconds + " milliseconds"); Console.WriteLine("Hit <enter> to continue..."); Console.ReadLine(); } } }