Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Having clauses missing from the generated CacheKey #403

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

Merged
mikebronner merged 5 commits into mikebronner:master from charlie-waddell:master
Dec 23, 2023

Conversation

@charlie-waddell
Copy link
Contributor

@charlie-waddell charlie-waddell commented Jun 24, 2021
edited
Loading

The issue:

When a query has having clauses, the changes are not detected because these appear to be missed from the generation of the cache key. Example:

// Assume there are 100 orders, the count will be 100
Order::query()
 ->selectRaw('updated_at as aliased_updated_at')
 ->count();
// Assume there are only 50 with an updated_at value greater than the given date/time,
// the count wil be pulled from the cached result of the above query, giving us 100 instead of 50
Order::query()
 ->selectRaw('updated_at as aliased_updated_at')
 ->having('aliased_updated_at', '>' ,'2021-01-01 00:00:00')
 ->count()

joeyrush reacted with thumbs up emoji mikebronner reacted with heart emoji
Copy link
Owner

@charlie-waddell Thanks so much for taking the time to write up a PR. I will try to get this merged soon.

charlie-waddell reacted with thumbs up emoji

Copy link
Owner

@mikebronner mikebronner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for submitting this! Could you write some tests to cover the code you added? Thanks!

charlie-waddell reacted with thumbs up emoji
Charlie Waddell added 2 commits May 27, 2022 16:14
Copy link

Restingo commented Jul 4, 2022

@charlie-waddell did you find some time to add tests? Thank you.

Copy link
Owner

If anyone would like to pick this up and add tests, that would be great. I'm happy to merge once those are in.

Signed-off-by: Mike Bronner <mike@genealabs.com>
@mikebronner mikebronner merged commit 19bcdf2 into mikebronner:master Dec 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mikebronner mikebronner mikebronner requested changes

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /