I have this method:
@Service // org.jboss.errai.bus.server.annotations.Service
class StuffServiceImpl implements StuffService {
@Override
public List<String> getStuffForUser(Account account) {
return restClient.getStuffByAccount(account);
}
}
Which is called many times during the lifetime of an application. I need to do a simple caching, where when the the same Account id is passed on the method, instead of calling the rest client again. It will just get the result from the cache.
I don't want to manually create a cache system, and would like to just use existing caching frameworks that is applicable.
And also, there should be a way to flush the "cache" for this method, which will be used during when the user logs out for example.