com.elasticpath.service.catalogview.impl
Class RefreshableCachedProductRetrieveStrategyImpl
java.lang.Object
com.elasticpath.service.impl.AbstractEpServiceImpl
com.elasticpath.service.catalogview.impl.AbstractProductRetrieveStrategyImpl
com.elasticpath.service.catalogview.impl.SingleCachingProductRetrieveStrategyImpl
com.elasticpath.service.catalogview.impl.RefreshableCachedProductRetrieveStrategyImpl
- All Implemented Interfaces:
- ProductRetrieveStrategy, RefreshableCachedProductRetrieveStrategy, EpService
public class RefreshableCachedProductRetrieveStrategyImpl
- extends SingleCachingProductRetrieveStrategyImpl
- implements RefreshableCachedProductRetrieveStrategy
Provides an implementation of ProductRetrieveStrategy
with JBoss tree caching ability. This service will return the same instance
of a product for all customers. Catalog promotion rules have already been applied on the returned products.
Notice: since the Product
is not thread-safe, you must not make any changes on the return product in your code. Otherwise, the
application may have some unexpected problem. Clients may optionally call refreshCacheEntry(..) to refresh the entry for a product from disk. To
use this feature, you must specify a default product load tuner.
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RefreshableCachedProductRetrieveStrategyImpl
public RefreshableCachedProductRetrieveStrategyImpl()
refreshCacheEntry
public void refreshCacheEntry(long productUid)
- Refresh the cache entry from disk for the product with the given UID.
- Specified by:
refreshCacheEntry
in interface RefreshableCachedProductRetrieveStrategy
- Parameters:
productUid
- the UID of the product whose cache entry is to be refreshed.
retrieveProduct
public Product retrieveProduct(long productUid,
ShoppingCart shoppingCart,
ProductLoadTuner productLoadTuner)
- Retrieve a
Product
with the given product uid. Return null
if a product with the given uid doesn't exist or the
product is not displayable.
- Specified by:
retrieveProduct
in interface ProductRetrieveStrategy
- Overrides:
retrieveProduct
in class SingleCachingProductRetrieveStrategyImpl
- Parameters:
productUid
- a product uidshoppingCart
- the customer shopping cartproductLoadTuner
- the product load tuner
- Returns:
- a
Product
with the given product uid.
setDefaultProductLoadTuner
public void setDefaultProductLoadTuner(ProductLoadTuner defaultProductLoadTuner)
- Set the default product load tuner to be used when refreshing the cache from disk.
- Parameters:
defaultProductLoadTuner
- the ProductLoadTuner
.
setRuleExecutionIntervalSeconds
public void setRuleExecutionIntervalSeconds(long seconds)
- Set the rule execution interval. If rules have not been fired within the specified number of seconds, rules are re-executed on any product
returned.
- Parameters:
seconds
- the interval in seconds