Superbalist / flysystem-google-cloud-storage

Flysystem Adapter for Google Cloud Storage
MIT License
265 stars 105 forks source link

Question: is it possible to set Cache-Control? #117

Closed radoslawkoziol closed 4 years ago

radoslawkoziol commented 4 years ago

As in the topic, is it possible to set cache-control metadata somehow? I've tried to do it this way:

        $fs->write($fileName, 'content', [
            'visibility' => AdapterInterface::VISIBILITY_PUBLIC,
            'Expires' => '10',
            'Cache-Control' => 'max-age=1000', // "Cache-Control" test1
            'CacheControl' => 'max-age=2000', // "CacheControl" test2
            'Metadata'     => [
                'param1' => 'value1',
                'param2' => 'value2'
            ],
            'metadata'     => [
                'param3' => 'value3',
                'param4' => 'value4'
            ]
        ]);

but it doesn't seem to be working (in fact, any of those).

I need to set it, because all of my files are public, but sometimes I need to update it and then I still see the old file.

radoslawkoziol commented 4 years ago

I've found the solution.

        $fs->write($fileName, 'content', [
            'metadata' => [
                'cacheControl' => 'public, max-age=10'
            ]
        ]);