Given list of employees
List<<EMPLOYEE>EMPLOYEE> empList;
POJO class:
Employee{
int id;
String name;
String address;
}
Input: empID as key to redis cache
Redis Cache sample JSON data:
(KEY)-> (VALUE)
1 -> {name:xyz, address:USA}
2 -> {name:ABC, address:Europe}
Requirement: Iterate through employee list and for every empID fetch the employee details by making Async Cache calls.
Once all Async calls are completed. Send a list of all the employees with all their details.
CompletableFuture.supplyAsync() does the task but get() method of completableFuture waits for every Async call to complete. Thus increasing the response time.
Even allOf() and join() method are increasing the time as they wait for Async task to complete
Any suggestions to decrease the Response time from cache?