com.netflix.hystrix.contrib.javanica.cache.annotation.CacheResult Java Examples

The following examples show how to use com.netflix.hystrix.contrib.javanica.cache.annotation.CacheResult. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UserService.java    From SpringAll with MIT License 5 votes vote down vote up
@CacheResult(cacheKeyMethod = "getCacheKey")
@HystrixCommand(fallbackMethod = "getUserDefault", commandKey = "getUserById", groupKey = "userGroup",
        threadPoolKey = "getUserThread")
public User getUser(Long id) {
    log.info("获取用户信息");
    return restTemplate.getForObject("http://Server-Provider/user/{id}", User.class, id);
}
 
Example #2
Source File: UserService.java    From SpringAll with MIT License 5 votes vote down vote up
@CacheResult(cacheKeyMethod = "getCacheKey")
@HystrixCommand(fallbackMethod = "getUserDefault", commandKey = "getUserById", groupKey = "userGroup",
        threadPoolKey = "getUserThread")
public User getUser(Long id) {
    log.info("获取用户信息");
    return restTemplate.getForObject("http://Server-Provider/user/{id}", User.class, id);
}
 
Example #3
Source File: UserService.java    From SpringAll with MIT License 5 votes vote down vote up
@CacheResult(cacheKeyMethod = "getCacheKey")
@HystrixCommand(fallbackMethod = "getUserDefault", commandKey = "getUserById", groupKey = "userGroup",
        threadPoolKey = "getUserThread")
public User getUser(Long id) {
    log.info("获取用户信息");
    return restTemplate.getForObject("http://Server-Provider/user/{id}", User.class, id);
}
 
Example #4
Source File: EurekaHystrixRibbonService.java    From fw-spring-cloud with Apache License 2.0 4 votes vote down vote up
@CacheResult
@HystrixCommand(fallbackMethod = "findUserByIdFailure")
public User findUserById(Long id) {
    // http://服务提供者的serviceId/url
    return restTemplate.getForObject("http://fw-cloud-ribbon-server/user/" + id, User.class);
}
 
Example #5
Source File: ClassService.java    From JetfireCloud with Apache License 2.0 4 votes vote down vote up
@HystrixCommand(fallbackMethod = "usersFallback")
@CacheResult
public Result users(String name) {
    return restTemplate.getForEntity("http://PRODUCER/product/?name={1}", Result.class, name).getBody();
}
 
Example #6
Source File: ClassService.java    From JetfireCloud with Apache License 2.0 4 votes vote down vote up
@HystrixCommand(fallbackMethod = "usersFallback")
@CacheResult
public Result users(Map map) {
    return restTemplate.postForEntity("http://PRODUCER/product/", map, Result.class).getBody();
}