Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
09-08-2020 08:59 PM
How can I possible object cache in Neo4j-ogm?
I want this because I want to have no cache in tests, so after updating the data in the database the updated objects are not cached and when loaded from the database the actual persisted version is loaded not the version I myself gave to Neo4j. Without disabling the cache one may use a session.clear() after each update operation, which is not a clean solution.
Solved! Go to Solution.
09-21-2020 07:48 AM
Neo4j-OGM is built with the cache as its backbone and all the logic like knowing how deep the data was fetched and similar things are persisted also in this cache.
So simply disabling it will not only solve your problem but introduce others again.
If you really want to get rid of the cache clears, the even more expensive solution would be to derive a new session from the SessionFactory
. This would on the other hand express exactly what you want to test.
Even better would be to use the Neo4j-OGM classes only for your logic you want to test and verify / assert via the pure driver that the data is there (or creating the data to test your load/fetch logic).
09-21-2020 07:48 AM
Neo4j-OGM is built with the cache as its backbone and all the logic like knowing how deep the data was fetched and similar things are persisted also in this cache.
So simply disabling it will not only solve your problem but introduce others again.
If you really want to get rid of the cache clears, the even more expensive solution would be to derive a new session from the SessionFactory
. This would on the other hand express exactly what you want to test.
Even better would be to use the Neo4j-OGM classes only for your logic you want to test and verify / assert via the pure driver that the data is there (or creating the data to test your load/fetch logic).
All the sessions of the conference are now available online