shopizer-aplcache

added aplcache cache

7/16/2019 10:56:27 AM

Details

diff --git a/docker-compose.yml b/docker-compose.yml
index 53f1e30..cc8b28e 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -12,14 +12,11 @@ services:
     command: bash -c 'while !</dev/tcp/database/3306; do sleep 5; done; bash run.sh'
     environment:
       - JAVA_OPTS=${JAVA_OPTS:-"-Xms4096m -Xmx6124m"}
-      - TRACER_ENABLE=${TRACER_ENABLE:-true}
-      - TRACER_MINIMUM_EXECUTION_TIME=${TRACER_MINIMUM_EXECUTION_TIME:-1}
+      - CACHE_EVENTS=${CACHE_EVENTS:-/caching-approaches-comparison/applications/output/shopizer-aplcache-cache}
+      - CACHE_REGISTER_SIZE=false
+      - APLCACHE_CACHEABLE_PARAMETERS=/caching-approaches-comparison/applications/output/aplcache-shopizer-parameters.json
       - TRACER_SERIALISE_INTERNALS=false
-      - TRACER_VERBOSE=true
-      - TRACER_TRACES=/caching-approaches-comparison/applications/traces/shopizer
       - TRACER_IGNORED_PACKAGES=/caching-approaches-comparison/applications/uncached/shopizer/ignored
-      - TRACER_WHITELIST=/caching-approaches-comparison/applications/uncached/shopizer/whitelist
-      - TRACER_LOG=/caching-approaches-comparison/applications/output/shopizer-tracer.log
     volumes:
       - application:/application
       - /root/.m2:/root/.m2

pom.xml 4(+2 -2)

diff --git a/pom.xml b/pom.xml
index 4a997aa..e32883f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -44,8 +44,8 @@
     <dependencies>
 
         <dependency>
-            <groupId>br.ufrgs.inf.prosoft.applicationtracer</groupId>
-            <artifactId>ApplicationTracer</artifactId>
+            <groupId>br.ufrgs.inf.prosoft.aplcache</groupId>
+            <artifactId>APLCache</artifactId>
             <version>1.0</version>
         </dependency>
 

sm-core/pom.xml 52(+0 -52)

diff --git a/sm-core/pom.xml b/sm-core/pom.xml
index 4e8c652..da1d464 100644
--- a/sm-core/pom.xml
+++ b/sm-core/pom.xml
@@ -203,57 +203,5 @@
 		</dependency>
 		
 	</dependencies>
-	
-	<build>
-		<plugins>
-			<plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>aspectj-maven-plugin</artifactId>
-                <version>1.11</version>
-                <configuration>
-                    <showWeaveInfo>false</showWeaveInfo>
-                    <complianceLevel>1.8</complianceLevel>
-                    <source>1.6</source>
-                    <target>1.6</target>
-                    <Xlint>ignore</Xlint>
-                    <encoding>UTF-8</encoding>
-                    <verbose>false</verbose>
-                    <forceAjcCompile>true</forceAjcCompile>
-                    <sources/>
-                    <weaveDirectories>
-                        <weaveDirectory>${project.build.directory}/classes</weaveDirectory>
-                    </weaveDirectories>
-                    <aspectLibraries>
-                        <aspectLibrary>
-                            <groupId>br.ufrgs.inf.prosoft.applicationtracer</groupId>
-                            <artifactId>ApplicationTracer</artifactId>
-                        </aspectLibrary>
-                    </aspectLibraries>
-                </configuration>
-                <executions>
-                    <execution>
-                        <phase>process-classes</phase>
-                        <goals>
-                            <goal>compile</goal>
-                        </goals>
-                    </execution>
-                </executions>
-                <dependencies>
-                    <dependency>
-                        <groupId>org.aspectj</groupId>
-                        <artifactId>aspectjrt</artifactId>
-                        <version>1.9.1</version>
-                    </dependency>
-                    <dependency>
-                        <groupId>org.aspectj</groupId>
-                        <artifactId>aspectjtools</artifactId>
-                        <version>1.9.1</version>
-                    </dependency>
-                </dependencies>
-            </plugin>
-		</plugins>
-	</build>
-	
-
 
 </project>
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/product/relationship/ProductRelationshipRepositoryImpl.java b/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/product/relationship/ProductRelationshipRepositoryImpl.java
index 1a943ff..f9105ca 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/product/relationship/ProductRelationshipRepositoryImpl.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/repositories/catalog/product/relationship/ProductRelationshipRepositoryImpl.java
@@ -14,6 +14,7 @@ import com.salesmanager.core.model.catalog.product.relationship.ProductRelations
 import com.salesmanager.core.model.merchant.MerchantStore;
 import com.salesmanager.core.model.reference.language.Language;
 
+import br.ufrgs.inf.prosoft.aplcache.caching.APLCache;
 
 public class ProductRelationshipRepositoryImpl implements ProductRelationshipRepositoryCustom {
 
@@ -21,8 +22,11 @@ public class ProductRelationshipRepositoryImpl implements ProductRelationshipRep
     @PersistenceContext
     private EntityManager em;
     
+public static APLCache<List<ProductRelationship>> getByTypeCache1 = new APLCache<>("ProductRelationshipRepositoryImpl.getByType1");
+
 	@Override
 	public List<ProductRelationship> getByType(MerchantStore store, String type, Product product, Language language) {
+return getByTypeCache1.computeIfAbsent(Thread.currentThread(), new Object[]{store, type, product, language}, () -> {
 
 		StringBuilder qs = new StringBuilder();
 		qs.append("select distinct pr from ProductRelationship as pr ");
@@ -54,12 +58,16 @@ public class ProductRelationshipRepositoryImpl implements ProductRelationshipRep
     	
     	return relations;
 		
+}, 1200000);
 
 	}
 	
+public static APLCache<List<ProductRelationship>> getByTypeCache2 = new APLCache<>("ProductRelationshipRepositoryImpl.getByType2");
+
 	@Override
 	public List<ProductRelationship> getByType(MerchantStore store, String type, Language language) {
 
+return getByTypeCache2.computeIfAbsent(Thread.currentThread(), new Object[]{store, type, language}, () -> {
 		StringBuilder qs = new StringBuilder();
 		qs.append("select distinct pr from ProductRelationship as pr ");
 		qs.append("left join fetch pr.product p ");
@@ -100,6 +108,7 @@ public class ProductRelationshipRepositoryImpl implements ProductRelationshipRep
     	
     	return relations;
 		
+}, 1200000);
 
 	}
 	
@@ -185,8 +194,11 @@ public class ProductRelationshipRepositoryImpl implements ProductRelationshipRep
 	}
 	
 	
+public static APLCache<List<ProductRelationship>> getByTypeCache3 = new APLCache<>("ProductRelationshipRepositoryImpl.getByType3");
+
 	@Override
 	public List<ProductRelationship> getByType(MerchantStore store, String type) {
+return getByTypeCache3.computeIfAbsent(Thread.currentThread(), new Object[]{store, type}, () -> {
 
 		StringBuilder qs = new StringBuilder();
 		qs.append("select distinct pr from ProductRelationship as pr ");
@@ -212,6 +224,7 @@ public class ProductRelationshipRepositoryImpl implements ProductRelationshipRep
 
     	
     	return relations;
+}, 1200000);
 		
 
 	}
@@ -249,8 +262,11 @@ public class ProductRelationshipRepositoryImpl implements ProductRelationshipRep
 
 	}
 	
+public static APLCache<List<ProductRelationship>> getByTypeCache4 = new APLCache<>("ProductRelationshipRepositoryImpl.getByType4");
+
 	@Override
 	public List<ProductRelationship> getByType(MerchantStore store, String type, Product product) {
+return getByTypeCache4.computeIfAbsent(Thread.currentThread(), new Object[]{store, type, product}, () -> {
 		
 		StringBuilder qs = new StringBuilder();
 		
@@ -293,6 +309,7 @@ public class ProductRelationshipRepositoryImpl implements ProductRelationshipRep
     	
     	return relations;
 		
+}, 1200000);
 
 	}
 
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/repositories/content/ContentRepositoryImpl.java b/sm-core/src/main/java/com/salesmanager/core/business/repositories/content/ContentRepositoryImpl.java
index 40a2e16..eeb68d4 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/repositories/content/ContentRepositoryImpl.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/repositories/content/ContentRepositoryImpl.java
@@ -13,6 +13,7 @@ import com.salesmanager.core.model.content.ContentType;
 import com.salesmanager.core.model.merchant.MerchantStore;
 import com.salesmanager.core.model.reference.language.Language;
 
+import br.ufrgs.inf.prosoft.aplcache.caching.APLCache;
 
 public class ContentRepositoryImpl implements ContentRepositoryCustom {
 
@@ -20,9 +21,12 @@ public class ContentRepositoryImpl implements ContentRepositoryCustom {
     @PersistenceContext
     private EntityManager em;
     
+public static APLCache<List<ContentDescription>> listNameByTypeCache = new APLCache<>("ContentRepositoryImpl.listNameByType");
+
 	@Override
 	public List<ContentDescription> listNameByType(List<ContentType> contentType, MerchantStore store, Language language) {
 		
+return listNameByTypeCache.computeIfAbsent(Thread.currentThread(), new Object[]{contentType, store, language}, () -> {
 
 
 			StringBuilder qs = new StringBuilder();
@@ -56,6 +60,7 @@ public class ContentRepositoryImpl implements ContentRepositoryCustom {
 			}
 			
 			return descriptions;
+}, 1200000);
 
 	}
 	
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/category/CategoryServiceImpl.java b/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/category/CategoryServiceImpl.java
index 7dd7467..d5df237 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/category/CategoryServiceImpl.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/services/catalog/category/CategoryServiceImpl.java
@@ -23,6 +23,8 @@ import com.salesmanager.core.model.catalog.product.Product;
 import com.salesmanager.core.model.merchant.MerchantStore;
 import com.salesmanager.core.model.reference.language.Language;
 
+import br.ufrgs.inf.prosoft.aplcache.caching.APLCache;
+
 @Service("categoryService")
 public class CategoryServiceImpl extends SalesManagerEntityServiceImpl<Long, Category> implements CategoryService {
 	
@@ -352,14 +354,21 @@ public class CategoryServiceImpl extends SalesManagerEntityServiceImpl<Long, Cat
 
 	}
 	
+public static APLCache<List<Category>> listByDepthCache1 = new APLCache<>("CategoryServiceImpl.listByDepth1");
+
 	@Override
 	public List<Category> listByDepth(MerchantStore store, int depth) {
+return listByDepthCache1.computeIfAbsent(Thread.currentThread(), new Object[]{store, depth}, () -> {
 		return categoryRepository.findByDepth(store.getId(), depth);
+}, 1200000);
 	}
-	
+
+public static APLCache<List<Category>> listByDepthCache2 = new APLCache<>("CategoryServiceImpl.listByDepth2");
 	@Override
 	public List<Category> listByDepth(MerchantStore store, int depth, Language language) {
+return listByDepthCache2.computeIfAbsent(Thread.currentThread(), new Object[]{store, depth, language}, () -> {
 		return categoryRepository.findByDepth(store.getId(), depth, language.getId());
+}, 1200000);
 	}
 
 	@Override
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/services/content/ContentServiceImpl.java b/sm-core/src/main/java/com/salesmanager/core/business/services/content/ContentServiceImpl.java
index 25f85e5..e33ed96 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/services/content/ContentServiceImpl.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/services/content/ContentServiceImpl.java
@@ -22,7 +22,7 @@ import com.salesmanager.core.model.content.OutputContentFile;
 import com.salesmanager.core.model.merchant.MerchantStore;
 import com.salesmanager.core.model.reference.language.Language;
 
-
+import br.ufrgs.inf.prosoft.aplcache.caching.APLCache;
 
 @Service( "contentService" )
 public class ContentServiceImpl
@@ -48,12 +48,16 @@ public class ContentServiceImpl
         this.contentRepository = contentRepository;
     }
 
+    public static APLCache<List<Content>> listByTypeCache1 = new APLCache<>("ContentServiceImpl.listByType1");
+
     @Override
     public List<Content> listByType( ContentType contentType, MerchantStore store, Language language )
         throws ServiceException
     {
 
+return listByTypeCache1.computeIfAbsent(Thread.currentThread(), new Object[]{contentType, store, language}, () -> {
         return contentRepository.findByType( contentType, store.getId(), language.getId() );
+}, 1200000);
     }
     
     @Override
@@ -70,12 +74,13 @@ public class ContentServiceImpl
     	return contentRepository.findByIdAndLanguage(id, language.getId());
     }
     
-
+public static APLCache<List<Content>> listByTypeCache2 = new APLCache<>("ContentServiceImpl.listByType2");
 
     @Override
     public List<Content> listByType(  List<ContentType> contentType,  MerchantStore store,  Language language )
         throws ServiceException
     {
+return listByTypeCache2.computeIfAbsent(Thread.currentThread(), new Object[]{contentType, store, language}, () -> {
 
 /*    	List<String> contentTypes = new ArrayList<String>();
     	for (int i = 0; i < contentType.size(); i++) {
@@ -83,27 +88,36 @@ public class ContentServiceImpl
         }*/
     	
         return contentRepository.findByTypes( contentType, store.getId(), language.getId() );
+}, 1200000);
     }
     
+public static APLCache<List<ContentDescription>> listNameByTypeCache = new APLCache<>("ContentServiceImpl.listNameByType");
+
     @Override
     public List<ContentDescription> listNameByType(  List<ContentType> contentType,  MerchantStore store,  Language language )
             throws ServiceException
     {
+return listNameByTypeCache.computeIfAbsent(Thread.currentThread(), new Object[]{contentType, store, language}, () -> {
 
 
             return contentRepository.listNameByType(contentType, store, language);
+}, 1200000);
     }
     
+public static APLCache<List<Content>> listByTypeCache3 = new APLCache<>("ContentServiceImpl.listByType3");
+
     @Override
     public List<Content> listByType(  List<ContentType> contentType,  MerchantStore store )
     throws ServiceException
     {
+return listByTypeCache3.computeIfAbsent(Thread.currentThread(), new Object[]{contentType, store}, () -> {
 /*    	List<String> contentTypes = new ArrayList<String>();
     	for (int i = 0; i < contentType.size(); i++) {
     		contentTypes.add(contentType.get(i).name());
         }*/
 
 	    return contentRepository.findByTypes( contentType, store.getId() );
+}, 1200000);
     }
 
     @Override
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/services/merchant/MerchantStoreServiceImpl.java b/sm-core/src/main/java/com/salesmanager/core/business/services/merchant/MerchantStoreServiceImpl.java
index 07af995..a288a05 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/services/merchant/MerchantStoreServiceImpl.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/services/merchant/MerchantStoreServiceImpl.java
@@ -22,6 +22,8 @@ import com.salesmanager.core.model.system.MerchantConfiguration;
 import com.salesmanager.core.model.tax.taxclass.TaxClass;
 import com.salesmanager.core.model.user.User;
 
+import br.ufrgs.inf.prosoft.aplcache.caching.APLCache;
+
 @Service("merchantService")
 public class MerchantStoreServiceImpl extends SalesManagerEntityServiceImpl<Integer, MerchantStore> 
 		implements MerchantStoreService {
@@ -76,10 +78,14 @@ public class MerchantStoreServiceImpl extends SalesManagerEntityServiceImpl<Inte
 	}
 	
 
+public static APLCache<MerchantStore> getByCodeCache = new APLCache<>("MerchantStoreServiceImpl.getByCode");
+
 	@Override
 	public MerchantStore getByCode(String code) throws ServiceException {
+return getByCodeCache.computeIfAbsent(Thread.currentThread(), new Object[]{code}, () -> {
 		
 		return merchantRepository.findByCode(code);
+}, 1200000);
 	}
 	
 /*	@Override
diff --git a/sm-core/src/main/java/com/salesmanager/core/business/services/system/MerchantConfigurationServiceImpl.java b/sm-core/src/main/java/com/salesmanager/core/business/services/system/MerchantConfigurationServiceImpl.java
index 50e0b52..c0b955a 100644
--- a/sm-core/src/main/java/com/salesmanager/core/business/services/system/MerchantConfigurationServiceImpl.java
+++ b/sm-core/src/main/java/com/salesmanager/core/business/services/system/MerchantConfigurationServiceImpl.java
@@ -16,6 +16,8 @@ import com.salesmanager.core.model.system.MerchantConfig;
 import com.salesmanager.core.model.system.MerchantConfiguration;
 import com.salesmanager.core.model.system.MerchantConfigurationType;
 
+import br.ufrgs.inf.prosoft.aplcache.caching.APLCache;
+
 @Service("merchantConfigurationService")
 public class MerchantConfigurationServiceImpl extends
 		SalesManagerEntityServiceImpl<Long, MerchantConfiguration> implements
@@ -41,9 +43,13 @@ public class MerchantConfigurationServiceImpl extends
 		return merchantConfigurationRepository.findByMerchantStore(store.getId());
 	}
 	
+public static APLCache<List<MerchantConfiguration>> listByTypeCache = new APLCache<>("MerchantConfigurationServiceImpl.listByType");
+
 	@Override
 	public List<MerchantConfiguration> listByType(MerchantConfigurationType type, MerchantStore store) throws ServiceException {
+return listByTypeCache.computeIfAbsent(Thread.currentThread(), new Object[]{type, store}, () -> {
 		return merchantConfigurationRepository.findByMerchantStoreAndType(store.getId(), type);
+}, 1200000);
 	}
 	
 	@Override
@@ -68,8 +74,11 @@ public class MerchantConfigurationServiceImpl extends
 		}
 	}
 	
+public static APLCache<MerchantConfig> getMerchantConfigCache = new APLCache<>("MerchantConfigurationServiceImpl.getMerchantConfig");
+
 	@Override
 	public MerchantConfig getMerchantConfig(MerchantStore store) throws ServiceException {
+return getMerchantConfigCache.computeIfAbsent(Thread.currentThread(), new Object[]{store}, () -> {
 
 		MerchantConfiguration configuration = merchantConfigurationRepository.findByMerchantStoreAndKey(store.getId(), MerchantConfigurationType.CONFIG.name());
 		
@@ -81,10 +90,12 @@ public class MerchantConfigurationServiceImpl extends
 			try {
 				config = mapper.readValue(value, MerchantConfig.class);
 			} catch(Exception e) {
-				throw new ServiceException("Cannot parse json string " + value);
+				// throw new ServiceException("Cannot parse json string " + value);
+				throw new RuntimeException("Cannot parse json string " + value);
 			}
 		}
 		return config;
+}, 1200000);
 		
 	}
 	

sm-shop/pom.xml 52(+0 -52)

diff --git a/sm-shop/pom.xml b/sm-shop/pom.xml
index 9eb8ac0..d9321d1 100644
--- a/sm-shop/pom.xml
+++ b/sm-shop/pom.xml
@@ -159,57 +159,5 @@
 
 		
 	</dependencies>
-	
-
-	<build>
-		<plugins>
-			<plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>aspectj-maven-plugin</artifactId>
-                <version>1.11</version>
-                <configuration>
-                    <showWeaveInfo>false</showWeaveInfo>
-                    <complianceLevel>1.8</complianceLevel>
-                    <source>1.6</source>
-                    <target>1.6</target>
-                    <Xlint>ignore</Xlint>
-                    <encoding>UTF-8</encoding>
-                    <verbose>false</verbose>
-                    <forceAjcCompile>true</forceAjcCompile>
-                    <sources/>
-                    <weaveDirectories>
-                        <weaveDirectory>${project.build.directory}/classes</weaveDirectory>
-                    </weaveDirectories>
-                    <aspectLibraries>
-                        <aspectLibrary>
-                            <groupId>br.ufrgs.inf.prosoft.applicationtracer</groupId>
-                            <artifactId>ApplicationTracer</artifactId>
-                        </aspectLibrary>
-                    </aspectLibraries>
-                </configuration>
-                <executions>
-                    <execution>
-                        <phase>process-classes</phase>
-                        <goals>
-                            <goal>compile</goal>
-                        </goals>
-                    </execution>
-                </executions>
-                <dependencies>
-                    <dependency>
-                        <groupId>org.aspectj</groupId>
-                        <artifactId>aspectjrt</artifactId>
-                        <version>1.9.1</version>
-                    </dependency>
-                    <dependency>
-                        <groupId>org.aspectj</groupId>
-                        <artifactId>aspectjtools</artifactId>
-                        <version>1.9.1</version>
-                    </dependency>
-                </dependencies>
-            </plugin>
-		</plugins>
-	</build>
-
 
 </project>
diff --git a/sm-shop/src/main/java/com/salesmanager/shop/filter/StoreFilter.java b/sm-shop/src/main/java/com/salesmanager/shop/filter/StoreFilter.java
index a26158d..ed869b0 100644
--- a/sm-shop/src/main/java/com/salesmanager/shop/filter/StoreFilter.java
+++ b/sm-shop/src/main/java/com/salesmanager/shop/filter/StoreFilter.java
@@ -51,6 +51,8 @@ import javax.servlet.http.HttpServletResponse;
 import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
 
+import br.ufrgs.inf.prosoft.aplcache.caching.APLCache;
+
 /**
  * Servlet Filter implementation class StoreFilter
  */
@@ -705,9 +707,12 @@ public class StoreFilter extends HandlerInterceptorAdapter {
 	   }
 */	
 	
+public static APLCache<Map<String, List<ContentDescription>>> getContentPagesNamesCache = new APLCache<>("StoreFilter.getContentPagesNames");
+
 	   private Map<String, List<ContentDescription>> getContentPagesNames(MerchantStore store, Language language) throws Exception {
+return getContentPagesNamesCache.computeIfAbsent(Thread.currentThread(), new Object[]{store, language}, () -> {
 		   
-		   
+		   try {
 		    Map<String, List<ContentDescription>> contents = new ConcurrentHashMap<String, List<ContentDescription>>();
 		   
 			//Get boxes and sections from the database
@@ -749,11 +754,16 @@ public class StoreFilter extends HandlerInterceptorAdapter {
 				}
 			}
 			return contents;
+		} catch (Exception ex){throw new RuntimeException(ex);}
+}, 1200000);
 	   }
 	   
+public static APLCache<Map<String, List<Content>>> getContentCache = new APLCache<>("StoreFilter.getContent");
+
 	   private Map<String, List<Content>> getContent(MerchantStore store, Language language) throws Exception {
+return getContentCache.computeIfAbsent(Thread.currentThread(), new Object[]{store, language}, () -> {
 		   
-		   
+		   try {
 		   Map<String, List<Content>> contents = new ConcurrentHashMap<String, List<Content>>();
 		   
 			//Get boxes and sections from the database
@@ -798,6 +808,8 @@ public class StoreFilter extends HandlerInterceptorAdapter {
 				}
 			}
 			return contents;
+			} catch (Exception ex){throw new RuntimeException(ex);}
+}, 1200000);
 	   }
 	   
 	   /**
@@ -880,8 +892,11 @@ public class StoreFilter extends HandlerInterceptorAdapter {
 			return objects;
 	   }
 	   
+public static APLCache<Map<String,Object>> getConfigurationsCache = new APLCache<>("StoreFilter.getConfigurations");
+
 	   @SuppressWarnings("unused")
 	private Map<String,Object> getConfigurations(MerchantStore store) {
+return getConfigurationsCache.computeIfAbsent(Thread.currentThread(), new Object[]{store}, () -> {
 		   
 		   Map<String,Object> configs = new HashMap<String,Object>();
 		   try {
@@ -920,6 +935,7 @@ public class StoreFilter extends HandlerInterceptorAdapter {
 		   }
 		   
 		   return configs;
+}, 1200000);
 		   
 	   }
 	   
diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/controller/category/facade/CategoryFacadeImpl.java b/sm-shop/src/main/java/com/salesmanager/shop/store/controller/category/facade/CategoryFacadeImpl.java
index 4296375..95bf97a 100644
--- a/sm-shop/src/main/java/com/salesmanager/shop/store/controller/category/facade/CategoryFacadeImpl.java
+++ b/sm-shop/src/main/java/com/salesmanager/shop/store/controller/category/facade/CategoryFacadeImpl.java
@@ -17,6 +17,7 @@ import javax.inject.Inject;
 import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
 
+import br.ufrgs.inf.prosoft.aplcache.caching.APLCache;
 
 @Service( value = "categoryFacade" )
 public class CategoryFacadeImpl implements CategoryFacade {
@@ -27,10 +28,14 @@ public class CategoryFacadeImpl implements CategoryFacade {
 	@Inject
 	private LanguageService languageService;
 
+public static APLCache<List<ReadableCategory>> getCategoryHierarchyCache = new APLCache<>("CategoryFacadeImpl.getCategoryHierarchy");
+
 	@Override
 	public List<ReadableCategory> getCategoryHierarchy(MerchantStore store,
 			int depth, Language language) throws Exception {
 		
+return getCategoryHierarchyCache.computeIfAbsent(Thread.currentThread(), new Object[]{store, depth, language}, () -> {
+	try {
 		List<Category> categories = categoryService.listByDepth(store, depth, language);
 		List<ReadableCategory> returnValues = new ArrayList<ReadableCategory>();
 		
@@ -78,6 +83,10 @@ public class CategoryFacadeImpl implements CategoryFacade {
          } );
 		
 		return returnValues;
+		                } catch (Exception ex) {
+                throw new RuntimeException(ex);
+        }
+}, 1200000);
 	}
 
 	@Override