PrepZone Logo
PrepZone
Back to AI Coding

AI Coding · Medium

The assistant added a cache to speed up a pricing lookup. Review it for production.

AI CodingCode ReviewStaff
java
@Service
public class PriceService {
    private final Map<String, BigDecimal> cache = new ConcurrentHashMap<>();

    public BigDecimal price(String sku, String currency) {
        return cache.computeIfAbsent(sku,
            k -> pricingClient.fetch(k, currency));
    }
}