Code example for Cache

Methods: getIfPresentput

0
            try { 
                String url = request.getServletPath() + "?" + request.getQueryString();
                boolean preload = Settings.getOrDefault(boolean.class, "dari/isCachingFilterPreloadEnabled", false);
 
                if (preload) {
                    Set<UUID> objectIds = ID_CACHE.getIfPresent(url);
                    if (objectIds != null) {
                        Query.from(Object.class).using(caching).where("id = ?", objectIds).selectAll();
                    } 
                } 
 
                chain.doFilter(request, response);
 
                if (preload) {
                    Set<UUID> objectIds = new HashSet<UUID>(caching.getIdOnlyQueryIds());
 
                    if (!objectIds.isEmpty()) {
                        ID_CACHE.put(url, objectIds);
                    } 
                } 
 
            } finally { 
                Database.Static.restoreDefault();