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.
However, if Object Versioning is turned on, that key might instead be like below.
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:
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:
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:
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.