2
我正在使用基于Netflix OSS体系结构的Spring云。我需要缓存使用Get-Set-Get模式的一种方法的结果。Netflix hystrix共享请求缓存
public class UserService {
@CacheResult
@HystrixCommand
public User getUserById(@CacheKey String id) { // GET
return storage.get(id);
}
@CacheRemove(commandKey = "getUserById")
@HystrixCommand
public void update(@CacheKey("id") User user) { // SET
storage.put(user.getId(), user);
}
}
现在我的问题很简单。如果我有多个此服务的实例正在运行,我需要知道我是否可以拥有分布式缓存?如果是的话,如果尺寸增大,我可以使用类似Redis的东西吗?