make S3 caching significantly more generic