/** * Clears the volatile cache attached to a user session. * * @param sessionInfo the session of a user. */ public static void clearFrom(SessionInfo sessionInfo) { VolatileResourceCacheService cache = sessionInfo .getCache() .get(VolatileResourceCacheService.class.getName(), VolatileResourceCacheService.class); if (cache != null) { cache.clear(); } }
/** Clears all the resources referenced into this instance of volatile cache. */ public void clear() { final VolatileResourceCacheService current = this; try { ManagedThreadPool.invoke( () -> { try { current.deleteAllAttachments(); } catch (RuntimeException e) { // This treatment must not disturb the server in any case, so nothing is thrown here. SilverLogger.getLogger(this) .error("The clear of volatile cache did not end successfully...", e); } }); } catch (RuntimeException e) { // This treatment must not disturb the server in any case, so nothing is thrown here. SilverLogger.getLogger(this) .error("The clear of volatile cache did not end successfully...", e); } }