package online.ruemu.franifer.payment.service; import org.springframework.data.redis.core.*; import org.springframework.stereotype.*; import java.time.*; import java.util.*; @Service public class IdempotencyService{private final StringRedisTemplate r; public IdempotencyService(StringRedisTemplate r){this.r=r;} public Optional<String> get(String k){return Optional.ofNullable(r.opsForValue().get("idem:"+k));} public void put(String k,String ref){r.opsForValue().set("idem:"+k,ref,Duration.ofHours(24));}}