Skip to content

Instantly share code, notes, and snippets.

View altfatterz's full-sized avatar
👨‍💻
Playing

Zoltan Altfatter altfatterz

👨‍💻
Playing
View GitHub Profile
@RequestMapping(method = RequestMethod.GET)
public @ResponseBody Page lookup(@RequestParam String name) {
long start = System.currentTimeMillis();
Page page = facebook.findPage(name);
long elapsed = System.currentTimeMillis() - start;
page.setLookupTime(elapsed);
return page;
}
mvn clean install
java -jar target/spring-caching-1.0-SNAPSHOT.jar
localhost:~ zoltan$ curl localhost:8080/lookup?name=backbase
{"name":"Backbase","website":"http://www.backbase.com/","lookupTime":90}localhost:~ zoltan$ curl localhost:8080/lookup?name=backbase
{"name":"Backbase","website":"http://www.backbase.com/","lookupTime":62}localhost:~ zoltan$ curl localhost:8080/lookup?name=backbase
{"name":"Backbase","website":"http://www.backbase.com/","lookupTime":65}localhost:~ zoltan$ curl localhost:8080/lookup?name=backbase
{"name":"Backbase","website":"http://www.backbase.com/","lookupTime":70}localhost:~ zoltan$
java -jar target/spring-caching-1.0-SNAPSHOT.jar --spring.profiles.active=ehcache
java -jar target/spring-caching-1.0-SNAPSHOT.jar --spring.profiles.active=hazelcast --server.port=8081
java -jar target/spring-caching-1.0-SNAPSHOT.jar --spring.profiles.active=hazelcast --server.port=8082
java -jar target/spring-caching-1.0-SNAPSHOT.jar --spring.profiles.active=redis
localhost:~ zoltan$ curl localhost:8080/lookup?name=backbase
{"name":"Backbase","website":"http://www.backbase.com/","lookupTime":572}localhost:~ zoltan$ curl localhost:8080/lookup?nam=backbase
{"name":"Backbase","website":"http://www.backbase.com/","lookupTime":1}localhost:~ zoltan$ curl localhost:8080/lookup?name=backbase
{"name":"Backbase","website":"http://www.backbase.com/","lookupTime":0}localhost:~ zoltan$ curl localhost:8080/lookup?name=backbase
{"name":"Backbase","website":"http://www.backbase.com/","lookupTime":1}localhost:~ zoltan$ curl localhost:8080/lookup?name=backbase
{"name":"Backbase","website":"http://www.backbase.com/","lookupTime":0}localhost:~ zoltan$
localhost:~ zoltan$ curl localhost:8082/lookup?name=google
{"name":"Google","website":"www.google.com","lookupTime":132}localhost:~ zoltan$ curl localhost:8081/lookup?name=google
{"name":"Google","website":"www.google.com","lookupTime":3}localhost:~ zoltan$
@altfatterz
altfatterz / GreetingService.java
Created October 12, 2014 20:55
GreetingService
@Service
public class GreetingService {
private static final Logger LOGGER = LoggerFactory.getLogger(GreetingService.class);
@Value("${greeting.name:World}")
private String name;
public String greet() {
if (LOGGER.isDebugEnabled()) {
git clone https://github.com/altfatterz/configuration-with-spring-boot
cd configuration-with-spring-boot
mvn clean package
java -jar target/configuration-with-spring-boot-0.0.1-SNAPSHOT.war