Skip to content

Instantly share code, notes, and snippets.

@robbypelssers
Created January 3, 2014 12:32
cachingdemo PricingServiceImpl
package com.pelssers.services;
import java.util.List;
import org.springframework.cache.annotation.Cacheable;
import com.google.common.collect.Lists;
public class PricingServiceImpl implements PricingService {
@Cacheable(value = "services.pricing", key = "#productId")
public List<Integer> getPriceHistory(Long productId) {
System.out.println("Fetching prices from DB");
return Lists.newArrayList(2, 6, 8, 5, 9);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment