aspose file tools*
The moose likes Object Relational Mapping and the fly likes Dynamically change Ehcache configuration through hibernate and Spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Dynamically change Ehcache configuration through hibernate and Spring" Watch "Dynamically change Ehcache configuration through hibernate and Spring" New topic
Author

Dynamically change Ehcache configuration through hibernate and Spring

N Deepu
Greenhorn

Joined: Jul 28, 2011
Posts: 25

I want to use a Second-Level chache in my code which has Spring and hibernate. I've made all the configurations in spring-persistence.xml for Ehcache configuration and the cache is working fine. My problem is that the configurations are already set by default in the ehcache-failsafe.xml. When I change the value in database and refresh the page, the changes are not reflected immediately since the timeToIdleSeconds="120" in the xml. I want to change this to 0 so that the changes are reflected immediately. I tried doing this : CacheManager manager = CacheManager.create();

Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3860

I want to change this to 0 so that the changes are reflected immediately

Is this change for the lifetime of the application or some other combination?

SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
N Deepu
Greenhorn

Joined: Jul 28, 2011
Posts: 25

Is this change for the lifetime of the application or some other combination?


I want to retrieve the latest values from the cache when the database is updated. It is fetching the new values after 120 seconds. How do I change?
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3860

Cross posted. Please BeForthrightWhenCrossPostingToOtherSites.

You might want to look at this for an alternate way to configure at runtime. But I haven't looked in to how/whether Hibernate support this.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dynamically change Ehcache configuration through hibernate and Spring