File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamically change Ehcache configuration through hibernate and Spring

 
N Deepu
Greenhorn
Posts: 28
Eclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3908
9
Chrome Fedora Hibernate
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
N Deepu
Greenhorn
Posts: 28
Eclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3908
9
Chrome Fedora Hibernate
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic