class JSONCache {

    public static Response getOrCache(String identifier, Supplier<Response> jsonResponseSupplier) {
        byte[] found = cache.getIfPresent(identifier);
        if (found == null) {
            Response response = jsonResponseSupplier.get();
            cache.put(identifier, response.getBytes());
            return response;
        }
        return Response.builder()
                .setMimeType(MimeType.JSON)
                .setContent(found)
                .build();
    }

    private  JSONCache();

}