Fixes #307: Only set cache when json was valid
Merge branch 'master' of github.com:thephpleague/flysystem