Working but way too complicated s3 cache