0

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.

quarks
  • 33,478
  • 73
  • 290
  • 513

2 Answers2

0

Depending on the amount of data you are transferring, the HttpSession object might be useful in your situation. http://docs.oracle.com/javaee/1.3/api/javax/servlet/http/HttpSession.html

Chris Ryan
  • 131
  • 1
  • 3
0

u can use memcahe technique or Redis these are simple u can have flexibility to flush the cache.

java_dev
  • 125
  • 2
  • 3
  • 13