1

Uploaded a pdf srinu.pdf to Google Cloud Storage Bucket (using PHP), download from cloud its working fine, but when I changed the pdf content and upload to bucket again download the file it's always downloaded from old version pdf,

https://storage.googleapis.com/[bucket name]/srinu.pdf

When I am download from cloud GCS console works fine. It seems that the old pdf on the GC edge cache.

How to avoid the Edge cache (Without changing the Cache-control and consistency in GCS)?

3

If you do not set the Google Cache control you are actually using it:

NOTE: By default, publicly readable objects are served with a Cache-Control header allowing such objects to be cached for 3600 seconds.

If you need to ensure that updates become visible immediately, you should set a Cache-Control header of "Cache-Control:private, max-age=0, no-transform" on such objects. You can do this with the command:

gsutil setmeta -h "Content-Type:text/html" \
  -h "Cache-Control:private, max-age=0, no-transform" gs://bucket/*.html

Therefore I think it is not possible to disable the caching without changing the Google cache-control, however notice that Cache-Control only applies to objects with a public-read ACL, non-public data are not cache-able.

Note also that because objects can be cached in different places on the Internet, that can ignore metadata and act as they prefer, there is no way to force a cached object to expire globally (in the same way you can force your browser to refresh its cache).

Can you explain better why you want to avoid to use it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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