Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Using cacheAllData for all fetches except one unique operationId

    I've been using cacheAllData successfully for a while now but for one of the datasources where I use this I have a unique fetch operationId that should skip the cache and go straight to the server. I can't seem to find a way to do this. I've read the cacheAllData javadocs, but it seems to indicate that you can nominate an operationId to be the one that fills the cache and all others will go to the server, but that is backwards from what I need.

    I already have a lot of standard fetches, with no operationId, and those should all use the cache. Now I have one specific operationId that should be the exception and skip the cache. Is there any way to accomplish that, short of changing all of the normal cached fetches to use a "cacheAllDataOperationId" (a lot of work) just so I can make this one exception use a different operationId?

    #2
    You can use dsRequest.bypassCache to do this on a per-request basis. There's currently no way to do this on a per-operationId basis.

    Comment


      #3
      Thanks! That's just what I was looking for.

      Comment


        #4
        I spoke too soon. I tried setBypassCache and the request is still not going to the server. In this case I'm using dataSource.fetchData as follows.
        Code:
        // Skip the cache and get data from server
        DSRequest requestProperties = new DSRequest();
        requestProperties.setBypassCache(true);
        ipStoreDS.fetchData(criteria, null, requestProperties );
        Using the dev console I can see that the request is still showing [client only]. However, if I ipStoreDS.setCacheAllData(false) just before the fetch it does go to the server.

        Comment


          #5
          Sorry, should have been shouldUseCache:false.

          bypassCache is related to avoiding HTTP-level caching. shouldUseCache is for cacheAllData:true and other in-browser caching.

          Comment


            #6
            Excellent. Thank you. It works perfectly.

            Comment

            Working...
            X