05-Scan-Test.cs - Amazon DynamoDB
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 Amazon Web Services 服务入门

05-Scan-Test.cs

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

// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 using System; using System.Threading.Tasks; using Amazon.Runtime; using Amazon.DAX; using Amazon.DynamoDBv2.Model; namespace ClientTest { class Program { public static async Task Main(string[] args) { string endpointUri = args[0]; Console.WriteLine($"Using DAX client - endpointUri={endpointUri}"); var clientConfig = new DaxClientConfig(endpointUri) { 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 = await client.ScanAsync(request); Console.WriteLine($"{i}: Scan succeeded"); } var endTime = DateTime.Now; TimeSpan timeSpan = endTime - startTime; Console.WriteLine($"Total time: {timeSpan.TotalMilliseconds} milliseconds"); Console.WriteLine("Hit <enter> to continue..."); Console.ReadLine(); } } }