• Resolved Will Stocks

    (@willstockstech)


    Hi guys,
    Is there any API documentation anywhere? I’m trying to work out how I can call w3tc_CdnEngine_S3_Cf_invalidate (not even sure if this is right!) from my theme/plugin based on when I update a particular file/image.

    Is w3tc_CdnEngine_S3_Cf_invalidate(array('\wp-content\myimages\image1.jpg)); along the correct lines?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Will Stocks

    (@willstockstech)

    Or should that be: `W3TC\CdnEngine_S3_Cf->invalidate(array(‘\wp-content\myimages\image1.jpg’));

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello,

    You can use w3tc_cdn_purge_files (deprecated but works)

    Thread Starter Will Stocks

    (@willstockstech)

    Thanks @vmarko – can you confirm that this would only invalidate the file/URL in Cloudfront and not PURGE the file?
    I only want to call the invalidate path, when an image is updated (it would have the exact same URL).
    An example of what I’m trying to do:
    https://cdn.willstocks.com/wp-content/uploads/optimum-gravatar-cache/avatar/2.jpg?d=thb95k
    This image is a user/commenter/author avatar. A daily check occurs to see whether a Gravatar has updated (using @jomisica’s OGC plugin) and I use W3TC to push those images up to my CDN (AWS S3 + Cloudfront, where I store all of my other image assets). If an image is updated, it gets a new query string on the end, to denote the datetime of the change. However, I saw yesterday that regardless of this query string, Cloudfront was still caching 2.jpg as the old image until I invalidated that specific URL.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @willstockstech,

    Yes, it only sends an invalidation request to CDN.
    It’s also possible to configure CloudFront so that it will respect query strings via “Query String Forwarding and Caching” parameter, so invalidation will not be required.

    Thread Starter Will Stocks

    (@willstockstech)

    Nice one – thanks @vmarko. I thought I had the query string forwarding enabled, however I will triple check this!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘API Documentation’ is closed to new replies.