From e32dc81dbb34457669664bae1a382bc5c107a865 Mon Sep 17 00:00:00 2001 From: Padraic Shafer Date: Sat, 23 Apr 2022 17:04:51 -0700 Subject: [PATCH] Decorator creates cache with Cache() constructor * See #473: Deprecate using cache specific constructors * https://github.com/aio-libs/aiocache/issues/473 * `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 is now applied to `cached._get_cache()` --- aiocache/decorators.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/aiocache/decorators.py b/aiocache/decorators.py index 202a45cc..7e85543d 100644 --- a/aiocache/decorators.py +++ b/aiocache/decorators.py @@ -205,7 +205,12 @@ async def decorator(self, f, *args, **kwargs): def _get_cache(cache=Cache.MEMORY, serializer=None, plugins=None, **cache_kwargs): - return cache(serializer=serializer, plugins=plugins, **cache_kwargs) + return Cache( + cache, + serializer=serializer, + plugins=plugins, + **cache_kwargs, + ) def _get_args_dict(func, args, kwargs):