Skip to content

Caffeine with reactive mongo Template #1679

Answered by ben-manes
Kamal5999 asked this question in Q&A
Discussion options

You must be logged in to vote
private class ScriptCacheLoader implements AsyncCacheLoader<String, IGroovyScript> {
    @Override
    public  CompletableFuture<IGroovyScript> asyncLoad(@NonNull String key) throws Exception {
        log.error("load method has being called");
        return  scriptRepository.findScriptByKey(key)
                .doOnError(err -> log.error("Error while fetching data from repository : ", err))
                .doOnSuccess(script -> log.info("data with key {} is loaded successfully",key))
                .toFuture();
    }
}

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@Kamal5999
Comment options

@ben-manes
Comment options

@ben-manes
Comment options

Answer selected by Kamal5999
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants