@Cacheable(cacheNames = "user", unless = "#result.id != null", key = "#id")
public Mono<User> index(@PathVariable Long id) {
        return Mono.just(MAP.get(id));
 }
public class User {
    private Long id;
    private String name;
}

Comment From: snicoll

Thanks for the report.

The condition is applied upfront so that result refers to the actual Mono<User> rather than User as you would expect. We'll have to figure out how to delay the condition evaluation so that the actual result object is available.