Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Small improvement to the block method of the default cache driver. While developing my own cache layer for Laravel, I figured that that the block method on a cache lock didn't quite cover the work it should do in my opinion. This is because the while loop, which attempts to acquire the lock every 250 miliseconds, has a heavy ordering problem of executing the
usleep
and the timeout test. While failing to acquire the lock, it should immediately check if there will be a timeout after the following nap. Currently, if the method will end up in a timeout, it will unnecessarily execute anotherusleep
.The Lock will now use the
now()
method to do time management instead of using the InteractsWithTime trait. I don't know if that is out of line with the idea of the code, but it sure works without any issues.Currently i am using this own block implementation, but would love to work with the improvement within the framework itself.
And, thanks for the amazing framework!
Chears!