Custom hash function for arguments

I often pass classes to cached functions, which represent data objects. Those classes can usually be identified by a small string and may contain changing objects which are not relevant for the called function. Hence, it is comfortable to specify my own hash function for identifying argument matches.
Here is a small patch that allows to pass a dictionary with custom hash functions for each argument to the cache(...) function. I use the patch since months in research code. It can be seen as a generalization of the ignore argument. Maybe it is of use for others, too.