Page 1 of 1

what is cache management strategy in broadleaf?

Posted: Mon Feb 18, 2013 4:56 am
by gk12
Hi,

Can anyone explain how caching works in broadleaf?

First of all is there any cache or do we hit the database every time we request for a product or category?

Re: what is cache management strategy in broadleaf?

Posted: Mon Feb 18, 2013 12:22 pm
by TNuzzi
gk12,
Not sure if this helps but there is a section in Broadleaf docs where they talk about caching in production.

http://docs.broadleafcommerce.org/2.2/P ... tions.html

Tony

Re: what is cache management strategy in broadleaf?

Posted: Mon Feb 18, 2013 1:28 pm
by phillipuniverse
Thanks for the link TNuzzi

For your specific question regarding catalog browsing, the category pages (which displays the list of products) actually hits Solr and not the database. See CategoryHandlerMapping for how this works.

Re: what is cache management strategy in broadleaf?

Posted: Tue Feb 19, 2013 1:12 am
by gk12
Thanks a lot. That certainly did help.
I want to extend the search service to find all the products in the system.
I was able to do the following and it is working fine. My concern is it should not hit the database everytime.

Can you help how we can extend SolrSearchServiceImpl ?

Code: Select all

@Service("mySearchService")
public class MySearchServiceImpl extends DatabaseSearchServiceImpl{
   public ProductSearchResult findAllProducts() throws ServiceException {

        ProductSearchResult result = new ProductSearchResult();
        List<Product> products = catalogService.findAllProducts();
        result.setProducts(products);
        result.setTotalResults(products.size());
        result.setPage(1);
        result.setPageSize(products.size());
        return result;   
   }
}