Win a copy of Programmers Guide to Apache Thrift this week in the Open Source forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Clearing L2 Cache using hibernate  RSS feed

Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI All,

I have configured in such a way that, i run a servlet which pulls the data from database and puts in to the L2 cache and i refer this cache hereafter. Problem is when ever updation is done on the datbase, the only way my L2 cache gets updated is by restarting my server and again running my servlet.
Is there a way to clear the L2 cache. if so is that entire L2 cache will be deleted or is there a way to clear only few object without restarting the server

if possible kindly let me know some examples
Posts: 17344
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, first when you define your cache regions for the second level cache, you put the level of updating that would occur, I think as the isolation level. This makes the second level cache update when an update occurs, as long as that update occurs in the same application, if some legacy app changes the data, Hibernate will not know that data has changed and your 2l cache will have stale data.

To evict from Second Level cache you use the evict methods on the SessionFactory, it can evict all or single objects.

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!