Fix cache keys

This PR adds tests for the cache keys used when compiling array reduction operations, and fixes a copy-paste error that resulted in an incorrect cache key being used for `array_prod`.

Since we anticipate more array reduction operations, a test generator is implemented that should make it straightforward to test the cache keys of all these new implementations as well.