You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #428 (PR: #432), the feature to create a cache from URLs was added. I would like to also be able to use this with decorators, which seems to currently not support this. I imagine there's a few ways of tackling this:
Adding direct support in the decorator. I would imagine a way to define the decorator with a kwarg like from_url which would then set up the cache based on the URL passed in.
Passing in a Cache object that was set up with Cache.from_url, meaning either a new kwarg or overloading the existing cache arg to take either a class or an object.
Changing the config structure to allow configuration with URL. For instance, defining a key with just one key/value of from_url and the URL (and other options like plugins and serializers of course). This would allow the decorator code to remain unchanged and simply use the alias feature already implemented.
I'd be happy to open a PR for any option (including something I missed).
Hey @jerr0328, maybe I would go for passing url param to the decorator and then inside the decorator create the instance with Cache.from_url which would be quite easy.
You make a point about adding support to use urls in the config but this would be a different feature that we can also add.
Feel free to contribute back please, happy to review! :)
I think with #609 in mind, this won't be relevant after that's solved. You'll likely need to pass a cache object to the decorator, which is essentially your option 2.
In #428 (PR: #432), the feature to create a cache from URLs was added. I would like to also be able to use this with decorators, which seems to currently not support this. I imagine there's a few ways of tackling this:
from_url
which would then set up the cache based on the URL passed in.Cache
object that was set up withCache.from_url
, meaning either a new kwarg or overloading the existingcache
arg to take either a class or an object.from_url
and the URL (and other options like plugins and serializers of course). This would allow the decorator code to remain unchanged and simply use thealias
feature already implemented.I'd be happy to open a PR for any option (including something I missed).
Edit: This is also somewhat relevant to #450
The text was updated successfully, but these errors were encountered: