django-cacheback icon indicating copy to clipboard operation
django-cacheback copied to clipboard

`cache_alias` option is not respected in FunctionJob and cacheback decorator

Open Kobold opened this issue 7 years ago • 1 comments
trafficstars

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:

https://github.com/codeinthehole/django-cacheback/blob/890772b5c37fba08e301eecbfeedc1180297ba14/cacheback/jobs.py#L16-L22

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. 🙂

Kobold avatar Oct 02 '18 20:10 Kobold

My PR fix that too.

https://github.com/codeinthehole/django-cacheback/pull/101

iurisilvio avatar May 29 '23 08:05 iurisilvio