Add cache key expansion for objects and arrays

Avoids some "safety" based use of `to_s` and ignores hash expansion
entirely.