Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add custom function for filtering cached arguments. #1
Left a monster comment discussing the API we want for this.
^ tests don't work well for me, I think because I don't have memcached setup locally. Not sure if on circleCI it worked or not, but now seems some tests fail, so might have worked, idk.
Nevertheless, should sort out the tests thing before merging this in. I'm not sure if all tests passed beforehand since some were failing for me because I don't have memcached running. Putting below which ones failed for me in master probably due to not running memcached on local.
Made the following changes:
Removed support for decorating methods
fn_key: omitted line number, used
__name__(is there a case we would still need the line number?)
Simplified the default implementation for
keynot to consider serialization
legacy_keyto remain compatible with previous cache key generation, added a test for that. Usage would be like this:
from cache_utils import cached, legacy_fn_key, legacy_key @cached(3600, fn_key=legacy_fn_key, key=legacy_key) def foo(...): ...
I like that you simplified the code even more and kept an option for the legacy way of doing it. We probably will be using those ourselves for old code.
See the only question with
None I had below. Otherwise I think we can merge this in.