3 Replies Latest reply on Feb 12, 2016 7:41 PM by gonmerciel

    PI Web API Cache with strange behavior

    jonasengedal

      Previously I stated that:

       

      "It appears that the PI Web API cache is acting rather strangely. differently when a request is send through Internet Explorer (11) and Chrome when Cache-Control header is not set on the request. With Chrome the request is not cached, but in IE it is cached."

       

      I thought I had found a pattern, but now it seems that Chrome is also having troubles. I am updating an event frame through System Explorer, but sometimes the update takes affect right away in PI Web API and sometimes it takes minutes. Each request is unique to avoid caching.

       

      Why is the data not updated right away in PI Web API? Buffering?

       

      I have also tried to set the Cache-Control header to "no-cache" explicitly on the request but then I face this:

       

      "Cache-Control header may not be specified on bulk data requests."

       

      When requesting https://<webapihost>/piwebapi/streamsets/<webid>/value with a webid for an eventframe.

       

      Is this a bug or is it just missing information in the documentation?

       

      Best regards

       

      Jonas

        • Re: PI Web API Cache with strange behavior
          dng

          Hi Jonas,

           

          From your description, your request is hitting the cache before it has been refreshed to reflect the latest change. By default, PI Web API caches are marked at five-minute intervals, so that can explain why update takes minutes to show up. However, you mentioned that "each request is unique to avoid caching". Can you explain how the request is formulated to avoid caching?

           

          Since PI Web API allocates a separate cache to each user, to test whether your issue is related to caching, can you try to connect with a different user to get the same event frame object in PI Web API to see if the other user is able to get the most updated information? (If this is a new request, the cache shouldn't have not have built up yet.)

           

          I believe the behavior you are seeing is by design, you cannot specify a cache-control header with bulk data requests. Let me check internally to see how we can update the documentation.

            • Re: PI Web API Cache with strange behavior
              dng

              Hi Jonas,

               

              We just sent a request to update our documentation about the cache-control header. Thanks for giving us the feedback!

              We are looking into removing this limitation in a future release. A workaround for now would be to issue a GET request with a cache-control header to the event frame in question, then get the values.

            • Re: PI Web API Cache with strange behavior
              gonmerciel

              Hi Jonas,

               

              Apparently accordin to this documentation, with the most recient version of the WebAPI (2015 R3), you can set a configuration to ignore the Cache-Control header for Streamsets requests.

               

              Regards,

               

              Gonzalo