This patch fixes the CacheRegion.cache_multi_on_arguments decorator so that it will (mostly) work on class methods.
Some of these fixes are rather ugly. They would probably be prettier if function_multi_key_generator were dumbed down so that it doesn't try to ignore the first argument when the wrapped function appears to be a method, since we now have to add a dummy self argument when we call it from set, invalidate, and get.
Refresh is still broken for class methods. It might be possible to fix it by making the function_multi_key_generator return a property, but I say it's not worth it.
Yeah, the issue here is that cache_multi_on_arguments has to mangle the arguments which it passes on to the decorated function, removing those keys for which it has cached results. (Cache_on_arguments has a simpler time of it — it simple calls (or not) the wrapped function/method with the original arguments.)
Function_multi_key_generator is currently method-aware, and when generating keys will ignore an initial self or cls argument, so that's half the battle. Cache_multi_on_arguments currently, however, never passes the self argument to the decorated method. It always calls the function. The crux is here: