Skip to content

support filter argument in cache decorator #15

@mattshin

Description

@mattshin

It would be nice to have an optional parameter such as filter in the @cache decorator that took as input a python callable w/ the wrapped function's *args and **kwargs and returned a boolean as to whether or not to cache.

The default could just be always true e.g. lambda x: True but users may want more nuanced control, based on the parameters to the function itself. In my particular case, I can't quite use cache-control header because i want to determine whether or not to cache on the server side based on query params.

If I get some time, I can jam on this and submit a PR, if you think it could be worthwhile?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions