• Task
  • Status: Open
  • 2 Major
  • Resolution:
  • cdennis
  • Reporter: amiller
  • September 17, 2009
  • 0
  • Watchers: 7
  • April 22, 2013


Given that we are going to ignore Cache.shutdown() methods on clustered caches, how can a user really really destroy that cache if it’s no longer needed. Certainly seems like users could be programmatically creating and destroying caches and expect that to be possible. Need new api.


Fiona OShea 2010-03-11

Updating Target = Darwin to Terracotta Target = Darwin

Fiona OShea 2010-03-24

does removing a cache allow it to be properly garbage collected?

Nitin Rana 2010-04-02

Tried with cache.dispose method and manager.shutdown methods. The cache is cleared from the local VM but not from the terracotta VM.

Fiona OShea 2010-08-11

Is this still an issue?

Chris Dennis 2010-08-12

What Nitin says is I believe true. When caches or cache managers are shutdown on a given client all the associated local memory is cleared by the JVM GC. The stores associated with these caches are however still persisted inside the TC server array (that is they are never DGC candidates). You could certainly save clustered heap space by emptying the caches before you shut them down, but it is impossible to remove them completely.

Unfortunately since a TC clustered cache is supposed to survive any number of client shutdowns, there is no lifecycle provided by the Ehcache API with which we can associate the destruction of a cache/cache manager. The same ‘problem’ exists for disk stores. There is no programmatic way to destroy the files that back a disk store, you just have to go in and delete them manually. Delete the disk store files would be the equivalent of deleting the object-db in the server.

Implementing this is mainly an exercise in designing a suitable API for Ehcache through which this can be acheived, unless this feature is heavily requested though I don’t see the need to do it now. No one has complained about the need to bounce their db to clear clustered cache state away (unless you count config related stuff which is a different matter).

Fiona OShea 2013-03-11

Please see linked issues - multiple customers are requesting this feature

Fiona OShea 2013-03-11

Can we doc how this works now, i.e. it is not possible. There may be workarounds. Please connect with Karthik on the details

ilevy 2013-03-12

This is documented in a number of of places.