Google Cloud Storage caching files despite disabling cache

117 views
Skip to first unread message

Paul Canning

unread,
Mar 19, 2015, 11:47:11 AM3/19/15
to google-a...@googlegroups.com
I am using file_put_contents and in some cases fopen + fwrite to create files in GCS.

I am setting "enable_cache" to false in the stream context, yet the files are being cached and hard-refreshing the page does nothing.

I even added in the header "Cache-Control" => "no-cache" even though I don't think it's supported yet.

In GCS, it shows the file was updated, but following the public link just shows a cached version.

How can I force it not to cache, and to show me the latest file?

Mars Lan

unread,
Mar 19, 2015, 6:39:55 PM3/19/15
to google-a...@googlegroups.com
Setting GCS object's Cache-Control header should be supported in the next release.

Paul Canning

unread,
Mar 19, 2015, 6:45:46 PM3/19/15
to google-a...@googlegroups.com
Understood, but why is GCS caching with the current "enable_cache" setting set to false?

Do I have to do anything specific with the way I use file_put_contents or fwrite?

Should I delete the object first?

Mars Lan

unread,
Mar 20, 2015, 6:19:05 PM3/20/15
to google-a...@googlegroups.com
The setting is for caching GCS objects in memcahe to improve performance in subsequent reads from App Engine. 

Paul Canning

unread,
Mar 21, 2015, 5:41:57 PM3/21/15
to google-a...@googlegroups.com
Again I understand, but it was still caching with it set to false....

Stuart Langley

unread,
Mar 21, 2015, 10:42:15 PM3/21/15
to google-a...@googlegroups.com
As Mars mentioned, enable_cache has nothing to do with the Cache-Control headers that are used when serving objects from Google Cloud Storage.

If controls the read-through cache that is used internally inside of app engine.

Paul Canning

unread,
Mar 23, 2015, 10:25:14 AM3/23/15
to google-a...@googlegroups.com
"enable_cache has nothing to do with the Cache-Control headers"

I get this. I fully understand they are two different things.

Again, I tried setting both, first one, then the other, then both. In all cases my objects were being cached.
Reply all
Reply to author
Forward
0 new messages