当前位置: 首页>>代码示例>>PHP>>正文


PHP DynamoDbClient::getCommand方法代码示例

本文整理汇总了PHP中Aws\DynamoDb\DynamoDbClient::getCommand方法的典型用法代码示例。如果您正苦于以下问题:PHP DynamoDbClient::getCommand方法的具体用法?PHP DynamoDbClient::getCommand怎么用?PHP DynamoDbClient::getCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Aws\DynamoDb\DynamoDbClient的用法示例。


在下文中一共展示了DynamoDbClient::getCommand方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: batchWriteItemAsync

 /**
  * {@inheritDoc}
  */
 public function batchWriteItemAsync(AwsDynamoDbRequest $request)
 {
     /* Create the command. */
     $command = $this->client->getCommand(self::COMMAND_TYPE_BATCH_WRITE_ITEM, $request->toArray());
     /* Execute the command. */
     return $this->executeAsyncCommand($command);
 }
开发者ID:ebidtech,项目名称:storage-client,代码行数:10,代码来源:AwsDynamoDbProxyService.php

示例2: listTables

 /**
  * @param string $pattern a pattern that table name should match, if emtpy, all tables will be returned
  *
  * @return array
  */
 public function listTables($pattern = '/.*/')
 {
     $tables = [];
     $lastEvaluatedTableName = null;
     do {
         $args = ["Limit" => 30];
         if ($lastEvaluatedTableName) {
             $args['ExclusiveStartTableName'] = $lastEvaluatedTableName;
         }
         $cmd = $this->db->getCommand('ListTables', $args);
         $result = $this->db->execute($cmd);
         if (isset($result['LastEvaluatedTableName'])) {
             $lastEvaluatedTableName = $result['LastEvaluatedTableName'];
         } else {
             $lastEvaluatedTableName = null;
         }
         foreach ($result['TableNames'] as $tableName) {
             if (preg_match($pattern, $tableName)) {
                 $tables[] = $tableName;
             }
         }
     } while ($lastEvaluatedTableName != null);
     return $tables;
 }
开发者ID:oasmobile,项目名称:php-aws-wrappers,代码行数:29,代码来源:DynamoDbManager.php

示例3: testImplementsCustomExponentialBackoffStrategy

 /**
  * @depends testIteratesOverScan
  */
 public function testImplementsCustomExponentialBackoffStrategy()
 {
     self::log('Getting an item a bunch of times in parallel');
     $batch = BatchBuilder::factory()->transferCommands(100)->build();
     $s = microtime(true);
     $total = 300;
     for ($i = 0; $i < $total; $i++) {
         $command = $this->client->getCommand('GetItem', array('TableName' => $this->table, 'Key' => $this->client->formatAttributes(array('HashKeyElement' => 'Test', 'RangeKeyElement' => 10))));
         $batch->add($command);
     }
     $retries = 0;
     foreach ($batch->flush() as $command) {
         $retries += $command->getRequest()->getParams()->get(BackoffPlugin::RETRY_PARAM);
     }
     $elapsed = microtime(true) - $s;
     self::log("Got the item {$total} times with {$retries} retries in {$elapsed} seconds");
 }
开发者ID:romainneutron,项目名称:aws-sdk-php,代码行数:20,代码来源:IntegrationTest.php

示例4: testGarbageCollection

 /**
  * Ensures that garbage collection functionality is working correctly
  */
 public function testGarbageCollection()
 {
     $currentCount = iterator_count($this->client->getIterator('Scan', array('TableName' => $this->table)));
     self::log('Put 10 expired items into the sessions table');
     $writeBatch = WriteRequestBatch::factory($this->client);
     for ($i = 1; $i <= 10; $i++) {
         $writeBatch->add(new PutRequest(Item::fromArray(array('id' => "example_{$i}", 'expires' => time() - 5 * Time::SECONDS)), $this->table));
     }
     $writeBatch->flush();
     self::log('Assert that all 10 items made it into the sessions table');
     $result = $this->client->getCommand('Scan', array('TableName' => $this->table))->execute();
     $this->assertEquals(10 + $currentCount, $result['Count'], 'Not all of the items were inserted.');
     self::log('Create a session handler to use with a lower batch size');
     $sh = SessionHandler::factory(array('dynamodb_client' => $this->client, 'table_name' => $this->table, 'gc_batch_size' => 3));
     self::log('Run the garbage collection');
     $sh->garbageCollect();
     self::log('Assert that all 10 items were deleted from the sessions table');
     $result = $this->client->getCommand('Scan', array('TableName' => $this->table))->execute();
     $this->assertEquals(0, $result['Count'], 'Not all of the items were removed.');
 }
开发者ID:romainneutron,项目名称:aws-sdk-php,代码行数:23,代码来源:IntegrationTest.php


注:本文中的Aws\DynamoDb\DynamoDbClient::getCommand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。