Provide a way for a function to be cached for just some of its arguments

Description

Use case: consider a function that takes a database connection pool and some other parameters. As things currently stand, you cannot memoize this function because the mutable connection object isn't useful as a key. It would be ideal to be able to specify a sort of cache-parameter-dispatch function at memoization, which would accept the incoming function arguments and return something that would be used as the cache key. The default behavior would be identity, but it would be easy to return a subset of the arguments provided, or some computed cache key.

Environment

None

Assignee

Sean Corfield

Reporter

Sean Corfield

Labels

None

Approval

None

Patch

None

Priority

Major
Configure