aiocache icon indicating copy to clipboard operation
aiocache copied to clipboard

Deprecate using cache specific constructors

Open argaen opened this issue 5 years ago • 3 comments

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

argaen avatar Dec 24 '19 08:12 argaen

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.

padraic-shafer avatar Apr 24 '22 00:04 padraic-shafer

This is an open issue, so doesn't look like anybody has deprecated anything yet.

Dreamsorcerer avatar Dec 30 '22 22:12 Dreamsorcerer

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()?

Dreamsorcerer avatar Jan 01 '23 23:01 Dreamsorcerer