Writing expiration metadata on cache write