Search code examples
portletehcachespring-portlet-mvc

Spring portlet ehcache delete cache on portlet undeploy


I am using Spring portlet ehcache in Liferay environment 6.x

problem is in dev environment if i drop portlet war to deploy folder. After 3-4 attempts it gives me perm gen/ out of memory exception.

Is there a way if my portlet getting redeploy or undeploy remove the cache, i know i can delete the cache by calling getCacheManager().remove("cacheKey"); but when i should to call this any idea how to hook it with portlet instance getting off?

Thanks in advance.


Solution

  • found solution

    @PreDestroy
    public void cleanup() {
    
         getCacheManager().removeCache(KEY_SERVICE_CACHE);
         getCacheManager().removeCache(KEY_SOURCE_CACHE);
    
    }