RMapCacheReactive::computeIfAbsent that accepts Mono<V>, Flux<V>, or CompletableFuture<V> as the second parameter.

Open
#5,587 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
java, redis

Research direction

Start at the RMapCacheReactive::computeIfAbsent entry point and inspect its existing overloads and reactive behavior. Add support for mapping functions returning Mono, Flux, or CompletableFuture, and verify that the new calls prevent duplicate computation during high load.

Written by the indexing model from the issue text.

Description

question

Hello. I want to invoke a method similar to RMapCacheReactive::computeIfAbsent, where the second argument is a mapping function returning Mono, Flux, or CompletableFuture, to prevent cache stampede on a single instance under high load. Please add this method.

Currently, I'm writing like this:

cache.get(key)
     .switchIfEmpty(reactiveRepository.findById(key)
         .flatMap(value -> cache.computeIfAbsent​(key, k -> value))
     );

I would like to:

cache.computeIfAbsent(key, k-> reactiveRepository.findById(k));
Dominant language
Java
Stars
24.4k
Forks
5.5k
Avg merge
2d 5h
Merged PRs (30d)
20

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from redisson/redisson

All issues in redisson/redisson

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.