diff --git a/CHANGELOG.md b/CHANGELOG.md index e214c68..df76ff8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/CacheKey.php b/src/CacheKey.php index 2ddca70..3a9d8f5 100644 --- a/src/CacheKey.php +++ b/src/CacheKey.php @@ -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(); } diff --git a/tests/CacheKeyTest.php b/tests/CacheKeyTest.php index 2bc75de..394b4cf 100644 --- a/tests/CacheKeyTest.php +++ b/tests/CacheKeyTest.php @@ -44,7 +44,6 @@ public static function invalidValues(): array return [ 'empty string' => [''], 'invalid character' => ['\\'], - 'too long' => [str_repeat('x', 65)], ]; } }