Skip to content

Commit

Permalink
clear cache
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanyuan2021 committed Aug 15, 2024
1 parent 98d1e5d commit 11de6f4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,22 @@ public JavaType[] getReqClass(String service, String methodName) {
return getRequestCache().get(key);
}

public Map<String, JavaType[]> getRequestCache() {
private Map<String, JavaType[]> getRequestCache() {
return requestClassCache.computeIfAbsent(getCurrentClassLoader(), k -> new ConcurrentHashMap<>());
}

public Map<String, JavaType> getResponseCache() {
private Map<String, JavaType> getResponseCache() {
return responseClassCache.computeIfAbsent(getCurrentClassLoader(), k -> new ConcurrentHashMap<>());
}

public void clearCache(ClassLoader classLoader) {
if (classLoader == null) {
return;
}
requestClassCache.remove(classLoader);
responseClassCache.remove(classLoader);
}

/**
* Fetch result class for cache according service and method
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,4 +395,7 @@ protected ObjectMapper getMapper() {
return this.mapper;
}

public void clearCache(ClassLoader classLoader) {
jacksonHelper.clearCache(classLoader);
}
}

0 comments on commit 11de6f4

Please sign in to comment.