I have a crazy idea : use Redis as hibernate second cache level. Redis is an in-memory datastore, it supports replication, pipeline, etc.. The goal is to share the hibernate cache between many tomcat nodes. The basic implementation should be to serailize Hibernate cache object key and value and store all into a Redis database. What do you think about that idea ?
Best regards,
Julius
Hibernate second-level caching with Redis Redis is an open-source, in-memory data structure store that is used to implement NoSQL key-value databases and caches. While Redis has a lot of features and benefits, it doesn't support the Java programming language out of the box.
Hibernate second level cache uses a common cache for all the session object of a session factory. It is useful if you have multiple session objects from a session factory. SessionFactory holds the second level cache data. It is global for all the session objects and not enabled by default.
Why Is a Second-Level Cache Important for Hibernate? A second-level cache improves application performance with regard to persistence for all sessions created with the same session factory.
I made Hibernate 2nd level cache with Redis
check it!
https://github.com/debop/hibernate-redis
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With