public void filterForbidden(ProxyContext context, ResourceDescriptor folder, ResourceFolderMetadata metadata) {
        if (!folder.isPublic() || !folder.isFolder()) {
            return;
        }

        Map<String, List<Rule>> rules = getCachedRules();
        Map<String, Boolean> cache = new HashMap<>();
        cache.put(ruleUrl(folder), true);

        List<? extends MetadataBase> filtered = metadata.getItems().stream().filter(item -> {
            ResourceDescriptor resource = ResourceDescriptorFactory.fromPublicUrl(item.getUrl());
            return evaluate(context, resource, rules, cache);
        }).toList();

        metadata.setItems(filtered);
    }
Key is updated time from the metadata. Value is decoded map (folder path, list of rules).
server/src/main/java/com/epam/aidial/core/server/service/RuleService.java