Widget caching not working as expected

We've developed a quick widget that reads some HTML using $core_v2_http.Get, then outputs it into the widget body, e.g.

#set($fileURL = "SOME_SERVER/${filename}.html")
#set($fileResponse = $core_v2_http.Get($fileURL, "%{ Headers = $headers, BypassUrlFiltering = 'false', IsCacheable = 'true', TimeoutSeconds = '5', VaryCacheByUser = 'false' }"))   

#if ($fileResponse.StatusCode==200)
    $fileResponse.Response
#end
 

As you can see in the snippet, IsCacheable is true in the .Get parameters.

We are also setting the widget itself to cacheable..

The widget displays the contents of that file fine, but it's not cached.. I can go & change the file contents and it's instantly updated in the widget, leading me to believe it's making the .Get request on every page view & isn't using the cache at all.

We have IsCacheable set in the .Get parameters AND in the widget. DevMode is not enabled on this environment.

What am I doing wrong? 

Parents
  • When caching is enabled on the request and VaryCacheByUser is false (or the user is anonymous) and the HTTP response does not specify Cache-Control: no-store, the response will be cached for the max-age value of Cache-Control from the response or, if no max-age is provided, 30 minutes. The cache key will be formed by the URL, headers, and any post data (so any variation will cause a cache miss).

    Any response that is cached is not guaranteed to be kept in the cache for its full cache duration as the cache can be pruned to size based on usage as needed.

    What is the value of the Cache-Control header for the URL you're requesting?

Reply
  • When caching is enabled on the request and VaryCacheByUser is false (or the user is anonymous) and the HTTP response does not specify Cache-Control: no-store, the response will be cached for the max-age value of Cache-Control from the response or, if no max-age is provided, 30 minutes. The cache key will be formed by the URL, headers, and any post data (so any variation will cause a cache miss).

    Any response that is cached is not guaranteed to be kept in the cache for its full cache duration as the cache can be pruned to size based on usage as needed.

    What is the value of the Cache-Control header for the URL you're requesting?

Children