Code example for Cache

Methods: getIfPresent

0
handlerChain.next(request, httpServletResponse);
    } 
 
    private String isUnsupported(String userAgentString) {
        String message = cache.getIfPresent(userAgentString);
        if (message == null) {
            ReadableUserAgent userAgent = parser.parse(userAgentString);
            message = isUnsupported(userAgent);
            cache.put(userAgentString, message);
        } 
        return message;
    } 
 
    private String isUnsupported(ReadableUserAgent userAgent) {
        if (MINIMUM_VERSION_BROWSERS.containsKey(userAgent.getName())) {
            VersionNumber minimumVersion = MINIMUM_VERSION_BROWSERS.get(userAgent.getName());
            if (userAgent.getVersionNumber().compareTo(minimumVersion) < 0) {
                String message = getUnsupportedMessage(userAgent);
                LOGGER.warn(message);