Refactor cache_key_func into standard function

Signed-off-by: Byron Ruth <b@devel.io>