aiocache
aiocache copied to clipboard
Deprecate using cache specific constructors
Cache
class was introduced as a proxy for instantiating the different backends. There should be only one way of doing things and Cache
is the preferred way of doing that so will deprecate the others
This should probably also apply to creating the cache inside the decorator @cached
. It looks like this might have been overlooked.
https://github.com/aio-libs/aiocache/blob/02782c238aa8a6ca238ef938b3c70e017dc5a2ea/aiocache/decorators.py#L207-L208
PR #568 was submitted.
This is an open issue, so doesn't look like anybody has deprecated anything yet.
I'm not sure how well this'll play with static typing, so I suspect we'll have to change this again as we introduce typing to the library.
It seems slightly odd to me that we instantiate a wrapper class and pass the implementation class as an argument, rather than just using it directly. i.e. Why do Cache(Cache.MEMORY)
and not just Cache.MEMORY()
or SimpleMemoryCache()
?