Marshal objects before storing in cache