Add flag to enable or disable struct instance cache