Allow custom key functions.

Adds an optional ``keys`` argument to take a function or functions to
generate additional cache keys.