Knowledge Base

Hi, How can we help?

Object Versioning Instead of cache invalidation

When WP Offload Media offloads a Media Library item to a storage provider’s bucket, it constructs an individual folder for the files, It is the current timestamp of file upload moment, for example, a file called “red-2.png” uploaded to the Media Library on January 8th, 2022 might end up with a key in the bucket like below.

https://companyoffload.s3.ap-south-1.amazonaws.com/wp-content/uploads/2022/08/red-2.png

However, if Object Versioning is turned on, that key might instead be like below.

https://companyoffload.s3.ap-south-1.amazonaws.com/wp-content/uploads/2022/08/11090242/qred-1.png

That extra “11090242” segment in the file’s key comes from WP Offload Media’s Object Versioning setting. It’s simply a timestamp, in this case, we can tell that red-2.jpg was offloaded to the bucket on the 11th day (of Aug).

If that file was then served via a CDN such as Amazon CloudFront using a custom domain (CNAME) of “cdn.example.com”, the final URL seen on a page for that image might be:

https://cdn.example.com/wp-content/uploads/2022/08/1090242/red-2.png

If that red-2.jpg was then removed from the bucket and re-offloaded a few days later, it could end up with a different key in the bucket, such as:

wp-content/uploads/2022/08/04132435/red-2.png

Now the Object Version is “04132435”, it has changed because WP Offload Media – Cloud Storage generates a new version when a file is offloaded to ensure that the object’s key is unique for that file’s re-offload.

Now the image’s URL is:

https://cdn.example.com/wp-content/uploads/2022/08/04132435/red-2.png

Since the URL for each media URL is different there is no requirement for cache invalidation from the CloudFront or any CDN provider. If an old file is removed and a file is uploaded with the same name can cause the issue that the old file is serving from the CDN provider because of the same URL. You need cache in-validation to serve the latest media. If the Object version is turned on, then each individual media will have a unique URL so there will not require a cache invalidation.

Customer Support

If you have questions about our plugin(s), are experiencing issues with any of our plugin