|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.parthparekh.service.cache.ProductCacheService
@Service @Transactional @Qualifier(value="cache") public class ProductCacheService
Caching layer for Product web service for create/update - this service will first change the product in mongoDb (by calling productServiceImpl) and then update the cache for get - this service will first check the cache; if the value is not found, it will query the mongoDb (by calling productSericeImpl)
Field Summary | |
---|---|
private static java.lang.String |
ALL_PRODUCTS_CACHE_KEY
|
private Cache |
cache
|
private static org.slf4j.Logger |
logger
|
private ProductService |
productService
|
private ProductServiceUtils |
productServiceUtils
|
Constructor Summary | |
---|---|
ProductCacheService()
|
Method Summary | |
---|---|
Product |
createProduct(Product product)
creates a product with name, description and price |
java.util.List<Product> |
getAll()
retrieves all the available products |
Product |
getProduct(java.lang.String id)
retrieves product information from id |
private void |
saveProductInCache(Product product)
|
Product |
updateProduct(java.lang.String id,
Product product)
update product information |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final org.slf4j.Logger logger
private static final java.lang.String ALL_PRODUCTS_CACHE_KEY
@Autowired @Qualifier(value="defaultCache") private Cache cache
@Autowired @Qualifier(value="default") private ProductService productService
@Autowired private ProductServiceUtils productServiceUtils
Constructor Detail |
---|
public ProductCacheService()
Method Detail |
---|
public Product createProduct(Product product)
ProductService
createProduct
in interface ProductService
product
- - product containing name, description, status and price
public Product getProduct(java.lang.String id)
ProductService
getProduct
in interface ProductService
id
- - product id
public java.util.List<Product> getAll()
ProductService
getAll
in interface ProductService
public Product updateProduct(java.lang.String id, Product product)
ProductService
updateProduct
in interface ProductService
id
- - product identifier to updateproduct
- - product object containing updated fields
private void saveProductInCache(Product product)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |