Clear cache before application id destroyed

pull/755/head
johnniang 2019-12-10 23:45:50 +08:00
parent d7a8723c61
commit f3e81b9bfb
1 changed files with 6 additions and 1 deletions

View File

@ -67,8 +67,8 @@ public class InMemoryCacheStore extends StringCacheStore {
log.debug("Preparing to put key: [{}], value: [{}]", key, cacheWrapper); log.debug("Preparing to put key: [{}], value: [{}]", key, cacheWrapper);
lock.lock();
try { try {
lock.lock();
// Get the value before // Get the value before
Optional<String> valueOptional = get(key); Optional<String> valueOptional = get(key);
@ -98,6 +98,11 @@ public class InMemoryCacheStore extends StringCacheStore {
public void preDestroy() { public void preDestroy() {
log.debug("Cancelling all timer tasks"); log.debug("Cancelling all timer tasks");
timer.cancel(); timer.cancel();
clear();
}
private void clear() {
CACHE_CONTAINER.clear();
} }
/** /**