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

Combine cached classes into a UNION to cut down on extravagant queries #560

Open
sabina-talipova opened this issue Oct 25, 2023 · 0 comments

Comments

@sabina-talipova
Copy link
Contributor

sabina-talipova commented Oct 25, 2023

Description

Investigate possible improvements for QueryCachingMiddleware::getCachedResponse by using DataQuery::union method to reduce additional queries.

See:

// On cache success validate against cached classes
foreach ($cached['classes'] as $class) {
// Note: Could combine these clases into a UNION to cut down on extravagant queries
// Todo: We can get last-deleted/modified as well for versioned records
$lastEditedDate = DataObject::get($class)->max('LastEdited');
if (strtotime($lastEditedDate ?? '') > strtotime($cached['date'] ?? '')) {
// class modified, fail validation of cache
return null;
}
}

@GuySartorelli GuySartorelli changed the title TODO: Combine cached classes into a UNION to cut down on extravagant queries Combine cached classes into a UNION to cut down on extravagant queries Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant