mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Caching null returns for findOneBy queries
#7405
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @dciprian-petrisor on GitHub (Aug 2, 2024).
Feature Request
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.