Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
felipehertzer opened this issue Sep 27, 2024 · 1 comment · Fixed by #52986
Closed

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

felipehertzer opened this issue Sep 27, 2024 · 1 comment · Fixed by #52986

Comments

@felipehertzer
Copy link

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

Copy link

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

felipehertzer added a commit to felipehertzer/framework that referenced this issue Sep 30, 2024
Close laravel#52954

This PR remove the duplicated prefix when use DynamoDB as cache drive and try to lock

DynamoDB Key now:
laravel_cache_laravel_cache_my-lock

DynamoDB Key after:
laravel_cache_my-lock
@crynobone crynobone linked a pull request Sep 30, 2024 that will close this issue
taylorotwell pushed a commit that referenced this issue Sep 30, 2024
Close #52954

This PR remove the duplicated prefix when use DynamoDB as cache drive and try to lock

DynamoDB Key now:
laravel_cache_laravel_cache_my-lock

DynamoDB Key after:
laravel_cache_my-lock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants