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. 🙂
Just that, if you pass the
cache_aliasoption to aFunctionJob(and hence thecachebackdecorator), the resulting function won't respect it. The reason why is becauseFunctionJob's super__init__is called beforeself.cache_aliasis set:django-cacheback/cacheback/jobs.py
Lines 16 to 22 in 890772b
But of course,
FunctionJob's super__init__depends onself.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. 🙂