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 null/empty returns for findOneBy #11584

Open
wants to merge 3 commits into
base: 3.3.x
Choose a base branch
from

Conversation

dciprian-petrisor
Copy link

On 'findOneBy' calls which return no an empty result set from the persister, null values are not cached.
This makes it so that repeat calls of 'findOneBy' with the same criteria, always hit the database.

The changes introduced in this commit make the AbstractEntityPersister cache the empty result set in the region, so that repeat calls do not hit the database again.

The existing mechanism to invalidate the query cache is sufficient; any persist/update performed to the region will invalidate it, exactly how it happens for non-empty result sets.

This is also more in-line with the way 'loadByCriteria' and 'loadAll' behave.

Fixes #11563

dciprian-petrisor and others added 3 commits August 23, 2024 23:04
On 'findOneBy' calls which return no an empty result set from the
persister, null values are not cached.
This makes it so that repeat calls of 'findOneBy' with the same
criteria, always hit the database.

The changes introduced in this commit make the AbstractEntityPersister
cache the empty result set in the region, so that repeat calls do not
hit the database again.

The existing mechanism to invalidate the query cache is sufficient; any
persist/update performed to the region will invalidate it, exactly how
it happens for non-empty result sets.

This is also more in-line with the way 'loadByCriteria' and 'loadAll'
behave.
@derrabus derrabus changed the base branch from 3.2.x to 3.3.x September 17, 2024 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Caching null returns for findOneBy queries
2 participants