Added hashcode caching for immutable types