-
Notifications
You must be signed in to change notification settings - Fork 77
Open
Description
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:
django-cacheback/cacheback/jobs.py
Lines 16 to 22 in 890772b
| 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. 🙂
Metadata
Metadata
Assignees
Labels
No labels