-
Notifications
You must be signed in to change notification settings - Fork 3
Scope: minimize the number of gets #41
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
Conversation
If getting the scope prefix value is a miss, then we all keys under the scope are by definition a miss, so we don't need to bother looking. This defers the generating and storing of the scope prefix value till we actually need it (on a set). In practice, this will reduce the number of gets if using getMultiple() or if you don't always *set()* on a miss.
66bfe5f to
0621920
Compare
masonmcelvain
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CR 👏🏻 but dev_block 👍🏻 on what might be a bug
The Short circuit should prevent getMultiple from being called and we weren't explicitly check for that.
We weren't using the $scopeValue we just created when doing the set(). Also, refactor it for clarity. Add a test to ensure we're setting the value.
masonmcelvain
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CR 👏🏻 Looks much better, thanks!
|
un_dev_block 👍 Looks like this is ready to test again. |
|
@danielbeardsley Does this need testing, or is it ready to merge? |
so phpunit stops complaining
|
It passes tests. So, I guess QA 👍 |
masonmcelvain
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CR 👏🏻
If getting the scope prefix value is a miss, then we all keys under the scope are by definition a miss, so we don't need to bother looking.
This defers the generating and storing of the scope prefix value till we actually need it (on a set). In practice, this will reduce the number of gets if using getMultiple() or if you don't always set() on a miss.