Caching using hibernate
I have 2 applications.First one is a web application through which we provision reference data.Second one is an ESB based application where the reference data is used.The reference data changes but not very frequently.We needed to cache the reference data.The web application( I am not the owner) used hibernate. But my ESB based application did not.We only used EHCache. When reference data is changed by the independent web application that needs to be reflected in ESB application.We implemented using message queue - that is when reference data changes web application sends a message to the message queue.Our ESB application listens to that message & clears the cache & caches the data once again.This works.But it is time intensive.How can I use Hibernate to improve the situation?
Regards, Subhen开发者_开发技巧du
Not really a Hibernate problem, from what I can see. I would say that this is more about caching itself. So, I would recommend looking at some distributed caches, specially Infinispan. This way, both applications can share the same cache and manipulate it. If you just use Hibernate, but the caches are still in different machines, with different states, then you'll face the same problem.
One solution could be to use EHCache in the Hibernate app, but you say, that you do not have any control over it...
So the only way I see for you, is to minimize the expenses and use many different cache regions and invalidate only small part of your cached data (in the same manner you do it now).
精彩评论