-
Notifications
You must be signed in to change notification settings - Fork 194
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
Hibernate 2nd level cache not working with GORM 6.1.11 #1266
Comments
Any clues, workaround or information on this? |
@sagrawal31 For my projects, I'm using https://github.com/purpleraven/grails-cows-cache-plugin . Hibernate 2nd level cache for me works well. And I didn't check it without the plugin But, as I know, Hibernate 2nd level cache works if you are requesting entity by primary key. |
@demon101 As per my understanding, Hibernate 2nd level cache works with any kind of query, not just primary key http:https://gorm.grails.org/6.1.x/hibernate/manual/#_caching_queries |
@sagrawal31 you are talking about query cache. |
@demon101 I'm not sure if I got your question. |
I spent another 6-7 hours, did all sorts of debugging by going through GORM -> Hibernate using debug points but couldn't make it work. Later on, I realized that I had to put Stupid me 😞 Sorry for the mess! |
Apologies if I'm creating a duplicate issue or I'm not following the doc but I did deep debugging till I'm capable of and went through various posts but couldn't get this working.
Task List
Stacktrace (if present) providedSteps to Reproduce
git clone [email protected]:wizpanda/test-l2-cache.git
create database test_l2_cache
grails-app/conf/application.yml
grails run-app
or./gradlew bootRun
http:https://localhost:8080/
and check the logsExpected Behaviour
Hibernate 2nd level cache is used in hibernate criteria using
cache(true)
:When this code is hit two times, 1st time it makes the database query which is expected but when the next time the same code is executed, it should not hit the database for the query instead it should get it from the cache.
Actual Behaviour
Criteria should not hit the database after 1st time unless the cache is evicted.
Environment Information
Example Application
https://github.com/wizpanda/test-l2-cache
The text was updated successfully, but these errors were encountered: