Skip to content

cache_alias option is not respected in FunctionJob and cacheback decorator #80

Description

@Kobold

Just that, if you pass the cache_alias option to a FunctionJob (and hence the cacheback decorator), the resulting function won't respect it. The reason why is because FunctionJob's super __init__ is called before self.cache_alias is set:

super(FunctionJob, self).__init__()
if lifetime is not None:
self.lifetime = int(lifetime)
if fetch_on_miss is not None:
self.fetch_on_miss = fetch_on_miss
if cache_alias is not None:
self.cache_alias = cache_alias

But of course, FunctionJob's super __init__ depends on self.cache_alias, so it's too late to influence the initialization of the cache.

I'm actually responsible for this bug, so I'll also submit a PR. 🙂

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions