Skip to content

[Cache] Duplicate Prefix on DynamoDB when acquire lock #52954

Closed
@felipehertzer

Description

@felipehertzer

Laravel Version

11

PHP Version

8.3

Database Driver & Version

No response

Description

Hi team,

I've noticed that the lock acquisition process in the DynamoDBStore class seems to apply a duplicate prefix when using DynamoDB as the cache driver.

Specifically, the DynamoDBStore->add method already adds the prefix, and then the DynamoDBStore->lock method adds the prefix again, which leads to redundancy.

You can view the relevant line here:
https://github.com/laravel/framework/blame/0d7842256c3441aef0aa3408a704c62096405090/src/Illuminate/Cache/DynamoDbStore.php#L415

Thanks

Steps To Reproduce

Run this code:

\Cache::lock("my-lock", 10)->get();

DynamoDB Key will be:
laravel_cache_laravel_cache_my-lock

It should be:
laravel_cache_my-lock

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions