method support in function_key_generator

Issue #95 new
Wolfgang Schnerring
created an issue

It would be nice if function_key_generator would support methods in addition to plain functions.

An example implementation is here: https://github.com/ZeitOnline/pyramid_dogpile_cache2/blob/1.0.1/src/pyramid_dogpile_cache2/cache.py#L26

I haven't found a way to do this other than computing the namespace during each function call (instead of only once and storing it in the closure), since at definition time I think you don't have enough information about the function etc. available.

Comments (2)

  1. Michael Bayer repo owner

    classmethods or instancemethods? the former is very hard. look through the PRs for various handwringing over this. this is why the function is pluggable.

  2. Log in to comment