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

Caching null returns for findOneBy queries #11563

Open
dciprian-petrisor opened this issue Aug 2, 2024 · 0 comments · May be fixed by #11584
Open

Caching null returns for findOneBy queries #11563

dciprian-petrisor opened this issue Aug 2, 2024 · 0 comments · May be fixed by #11584

Comments

@dciprian-petrisor
Copy link

dciprian-petrisor commented Aug 2, 2024

Feature Request

Q A
New Feature yes
RFC no
BC Break no

Summary

Currently, as can be seen in https://github.com/doctrine/orm/blob/3.2.x/src/Cache/Persister/Entity/AbstractEntityPersister.php#L315-L319, null return values are not cached.

I have a use-case that I believe is not all that uncommon: I frequently find myself looking for entities in my database matching some particular filters, which may or may not be there.
Most of the time actually, there are no matching records for that particular set of filters in my database.
I would like Doctrine to cache this output so that I do not end up hitting the database each time.

I do not yet have a technical proposal for this, however I imagine it is feasible to implement and would like take a stab at it.

This issue is raised for tracking purposes as well as to get a feel of whether maintainers are interested in this feature.

@dciprian-petrisor dciprian-petrisor linked a pull request Aug 23, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant