cloudstore-developers
Details
docker-compose.yml 10(+2 -8)
diff --git a/docker-compose.yml b/docker-compose.yml
index 4515f45..ee36186 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -10,14 +10,8 @@ services:
command: bash -c 'while !</dev/tcp/database/3306; do sleep 5; done; bash run.sh'
environment:
- JAVA_OPTS="-Xms4096m -Xmx6124m"
- - TRACER_ENABLE=${TRACER_ENABLE:-true}
- - TRACER_SERIALISE_INTERNALS=false
- - TRACER_VERBOSE=true
- - TRACER_TRACES=/caching-approaches-comparison/applications/traces/cloudstore
- - TRACER_LOG=/caching-approaches-comparison/applications/output/cloudstore-tracer.log
- - TRACER_BLACKLIST=/caching-approaches-comparison/applications/uncached/cloudstore/blacklist
- - TRACER_IGNORED_PACKAGES=/caching-approaches-comparison/applications/uncached/cloudstore/ignored
- - TRACER_WHITELIST=/caching-approaches-comparison/applications/uncached/cloudstore/whitelist
+ - CACHE_EVENTS=${CACHE_EVENTS:-/caching-approaches-comparison/applications/output/cloudstore-developers-cache}
+ - CACHE_REGISTER_SIZE=false
volumes:
- application:/application
- /root/.m2:/root/.m2
pom.xml 56(+4 -52)
diff --git a/pom.xml b/pom.xml
index 649e568..8c4cd26 100644
--- a/pom.xml
+++ b/pom.xml
@@ -187,62 +187,14 @@
</dependency>
<dependency>
- <groupId>br.ufrgs.inf.prosoft.applicationtracer</groupId>
- <artifactId>ApplicationTracer</artifactId>
+ <groupId>br.ufrgs.inf.prosoft.cache</groupId>
+ <artifactId>Cache</artifactId>
<version>1.0</version>
</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>
-
-
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
@@ -341,8 +293,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
- <source>1.6</source>
- <target>1.6</target>
+ <source>1.8</source>
+ <target>1.8</target>
<!-- <compilerArgument>-Xlint:all</compilerArgument> -->
<!-- <showWarnings>true</showWarnings> -->
<!-- <showDeprecation>true</showDeprecation> -->
diff --git a/src/main/java/eu/cloudscale/showcase/db/services/AService.java b/src/main/java/eu/cloudscale/showcase/db/services/AService.java
index 46672f1..239a01a 100755
--- a/src/main/java/eu/cloudscale/showcase/db/services/AService.java
+++ b/src/main/java/eu/cloudscale/showcase/db/services/AService.java
@@ -20,6 +20,8 @@ import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.cache.annotation.Cacheable;
import org.springframework.transaction.annotation.Transactional;
+import br.ufrgs.inf.prosoft.cache.MultiCache;
+
import eu.cloudscale.showcase.db.BuyConfirmResult;
import eu.cloudscale.showcase.db.common.ContextHelper;
import eu.cloudscale.showcase.db.dao.IAddressDao;
@@ -90,13 +92,17 @@ public abstract class AService implements IService
return sc;
}
+ public static MultiCache<String, List> getNewProductsCache = new MultiCache<>("getNewProductsCache");
+
@SuppressWarnings( "rawtypes" )
@Override
// @Cacheable("newProducts")
public List getNewProducts(String category)
{
- //System.out.println("getNewProducts(" + category + ") called!");
- return itemDao.getNewProducts( category );
+ return getNewProductsCache.computeIfAbsent(category, () -> {
+ //System.out.println("getNewProducts(" + category + ") called!");
+ return itemDao.getNewProducts( category );
+ }, 86400000);
}
@Override
@@ -545,29 +551,42 @@ public abstract class AService implements IService
return customerDao.findById( customerId );
}
+ public static MultiCache<String, List<Object[]>> getBestSellersCache = new MultiCache<>("getBestSellersCache");
+
@Override
// @Cacheable("bestSellers")
public List<Object[]> getBestSellers(String category)
{
- return itemDao.getBestSellers( category );
+ return getBestSellersCache.computeIfAbsent(category, () -> {
+ //System.out.println("getNewProducts(" + category + ") called!");
+ return itemDao.getBestSellers( category );
+ }, 86400000);
}
+ public static MultiCache<String, List<IItem>> searchByTitleCache = new MultiCache<>("searchByTitleCache");
+
@Override
// @Cacheable("search")
public List<IItem> searchByTitle(String keyword)
{
- List<IItem> items = itemDao.findAllByTitle( keyword );
+ return searchByTitleCache.computeIfAbsent(keyword, () -> {
+ List<IItem> items = itemDao.findAllByTitle( keyword );
- return items;
+ return items;
+ }, 86400000);
}
+ public static MultiCache<String, List<IItem>> searchBySubjectCache = new MultiCache<>("searchBySubjectCache");
+
@Override
// @Cacheable("search")
public List<IItem> searchBySubject(String keyword)
{
- List<IItem> items = itemDao.findAllBySubject( keyword );
-
- return items;
+ return searchBySubjectCache.computeIfAbsent(keyword, () -> {
+ List<IItem> items = itemDao.findAllBySubject( keyword );
+
+ return items;
+ }, 86400000);
}
@Override