-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[NFR]: ORM: Model Thread Cache, AKA First Level Cache or L1 cache #16411
Labels
new feature request
Planned Feature or New Feature Request
Comments
I would describe this more has a bug than a feature, data needs to be reliable across the thread, having two objects with the same data will induce the dev into persisting wrong information or having complicated methods to circumvent this issue. |
5 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
The ORM does not have a single source of truth when it fetches a new model.
That means that fetching the same model data from the database actually gives you two different instance objects of the same data.
This leads to false data, data losses, incorrect saves and longer saves.
Describe the solution you'd like
A thread cache that has all the models that are in memory, if that model with that Primary key is fetched the Thread cache will return the already instance model in memory.
If the model does not exists any longer in memory then a new instance will be made with fresh data.
Describe alternatives you've considered
There are none, this is by default in most ORMs, in java Hibernate it's not even an option, it is always on.
Additional context
https://www.linkedin.com/advice/3/what-benefits-drawbacks-using-orm-caching
https://howtodoinjava.com/hibernate/understanding-hibernate-first-level-cache-with-example/
The text was updated successfully, but these errors were encountered: