Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: extra key components #49

Open
pySilver opened this issue Mar 30, 2021 · 2 comments
Open

Feature Request: extra key components #49

pySilver opened this issue Mar 30, 2021 · 2 comments

Comments

@pySilver
Copy link
Contributor

Sometimes we know, that cache state should depend on some external data like some dependency last update datetime. It would be nice if extra args would be supported so one can pass smth like

@cache_memoize(60, extra=('foo', obj.pk, foo.unix_timestamp))
def foo(*args, **kwargs):
    return 42

This also solves #35

@raiyankamal
Copy link

Could the key_generator_callable help in this case?

key_generator_callable=None,

@pySilver
Copy link
Contributor Author

@raiyankamal yes and no. It is quickly become tedious when you need this extra parameters in literally every usage of the decorator. Such as when you want your cache to be versioned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants