我有这样的方法:缓存查询结果
@Service // org.jboss.errai.bus.server.annotations.Service
class StuffServiceImpl implements StuffService {
@Override
public List<String> getStuffForUser(Account account) {
return restClient.getStuffByAccount(account);
}
}
其是一个应用程序的生命周期内多次调用。我需要做一个简单的缓存,当方法传递相同的Account ID时,而不是再次调用其他客户端。它只会从缓存中获得结果。
我不想手动创建一个缓存系统,并且只想使用现有的适用的缓存框架。
而且,应该有一种方法来刷新此方法的“缓存”,该方法将在用户注销时使用。