RikudouSage / DynamoDbCachePsr6

PSR-6 and PSR-16 cache implementation using AWS DynamoDB
MIT License
6 stars 4 forks source link

Long cache keys are not truncated #19

Closed shadowhand closed 2 years ago

shadowhand commented 2 years ago

When a cache key exceeds 2048 characters, the following error will show up:

Code:    ValidationException
Message: One or more parameter values were invalid: Size of hashkey has exceeded the maximum size limit of2048 bytes
Type:    
Detail:

The problem is that there is no attempt to restrict/truncate the cache key. As I am unable to control the way that some packages (in this case, Symfony ExpressionLanguage) choose to set keys, errors will eventually occur.

One solution is to truncate the key and attach a hash to prevent collisions.