Change your cache file so that it doesn’t map hash code to result of calculation, but parameters to result of calculation.
Since the calculation takes very long, having to match the parameters shouldn’t be a big deal, even though it is somehow inefficient. And of course you _can_calculate hash codes for parameters that you compared in memory.