2

We use a storage extension to publish binaries to S3. The images, PDFs and movies are also cached with CloudFront and have 1 rule set to keep them cached for 1 hour.

We'd like to use the CloudFront API to flush items at publish time within the Custom Deployer, and only if they are newer. The code for CloudFront is working fine.

However, the task of identifying what items to flush is the challenge.

Is it possible to get the last modified date of the binary (multimedia Component) in the package and compare it with the last publish time? Is last publish time stored as part of the Binary or only the Page?

The other idea is to provide a metadata field on the multimedia component, flush cache, and get this field from the package at publish time.

Any other ideas?

1 Answer 1

1

The last modified date of a binary isn't any hard guarantee; if you use an external binary (located on the filesystem) you could have updated the file on the filesystem without Tridion being aware of it or the physical MM component being changed...

I'd suggest always clearing the cloudfront cache when an item is being re-deployed (which appears the simplest solution to not serve stale binaries out of CloudFront) but if for some reason it is really that important to only clear-on-update you might consider comparing a binary file being deployed with the original (any simple hash generation algorithm will do like CRC).

As an optimization to above solution you could store the CRC as metadata on the binary so you don't have to recalculate the value for already published binaries...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.