Simpler atomic write

Cache writes are already in a tmp dir, we don't need to write to
/tmp first. Just uses the current tmp dir. Then we don't need to
worry about permission changes either.