• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Clearing L2 Cache using hibernate

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Thanks
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

Mark
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic