Skip to content

Commit

Permalink
Handle empty arrays for DynamoDbStore multi-key operations (#46579)
Browse files Browse the repository at this point in the history
  • Loading branch information
nie7321 authored Mar 25, 2023
1 parent 833f7e8 commit 6011968
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Illuminate/Cache/DynamoDbStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ public function get($key)
*/
public function many(array $keys)
{
if (count($keys) === 0) {
return [];
}

$prefixedKeys = array_map(function ($key) {
return $this->prefix.$key;
}, $keys);
Expand Down Expand Up @@ -219,6 +223,10 @@ public function put($key, $value, $seconds)
*/
public function putMany(array $values, $seconds)
{
if (count($values) === 0) {
return true;
}

$expiration = $this->toTimestamp($seconds);

$this->dynamo->batchWriteItem([
Expand Down

0 comments on commit 6011968

Please sign in to comment.