Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redis as Hibernate second level cache

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

like image 668
juliusdev Avatar asked Oct 04 '11 15:10

juliusdev


People also ask

Is Redis a second level cache?

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.

Which 2nd level cache is better in Hibernate?

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.

Should I use Hibernate second level cache?

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.


1 Answers

I made Hibernate 2nd level cache with Redis

check it!

https://github.com/debop/hibernate-redis

like image 165
Debop Avatar answered Sep 19 '22 05:09

Debop