Conventions related to caching


Use this convention to determine if the client should cache the request for the given URL. By default all requests are cached:

conventions.setShouldCacheRequest(new RequestCachePolicy() {
  public Boolean shouldCacheRequest(String url) {
    return Boolean.TRUE;


It decides whether the client being in the aggressive cache mode should use Changes API to monitor notifications and rebuild the cache based on them. If the notification arrives then an outdated item from cache will be revalidated.


Note that it is still possible to get a stale result because of the time needed to receive the notification and checking for cached data.


In addition to the use of notifications, the aggressive cache also revalidates the cache after calling session.saveChanges(). This behavior is configurable by the following convention: