Skip to content

Commit

Permalink
Remove maximum key length
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegamez committed Jul 26, 2024
1 parent 9f80ffc commit 5f43f1f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
encoding and a length of up to 64 characters. Implementing libraries MAY support additional characters and encodings
or longer lengths, but must support at least that minimum.
* Dashes (`-`) are now allowed in cache keys.
* The arbitrary maximum key length of 64 characters has been removed.


## [1.1.0] - 2024-03-02
Expand Down
2 changes: 1 addition & 1 deletion src/CacheKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ private function __construct(private readonly string $value) {}

public static function fromString(string $value): self
{
if (preg_match('/^[a-zA-Z0-9_.-]{1,64}$/u', $value) !== 1) {
if (preg_match('/^[a-zA-Z0-9_.-]+$/u', $value) !== 1) {
throw InvalidArgument::invalidKey();
}

Expand Down
1 change: 0 additions & 1 deletion tests/CacheKeyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public static function invalidValues(): array
return [
'empty string' => [''],
'invalid character' => ['\\'],
'too long' => [str_repeat('x', 65)],
];
}
}

0 comments on commit 5f43f1f

Please sign in to comment.