本文整理汇总了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);
}
示例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;
}
示例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");
}
示例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.');
}