views:

550

answers:

2

i'm using 2nd level cache and query cache. may i know how to programatically clear all caches?

+4  A: 

To clear the session cache use session.clear()

To clear the 2nd level cache use this code snippet

Bozho
+1  A: 

If you plug in Terracotta, you also have the ability to run the Terracotta Dev Console which can inspect statistics about the cache, turn on and turn off the cache, and clear the cache contents from the user interface.

This functionality is also available from JMX beans.

Taylor Gautier