better cache key and tests -- store dtype as well as dim