Skip to content

Commit

Permalink
Decorator creates cache with Cache() constructor
Browse files Browse the repository at this point in the history
* See aio-libs#473: Deprecate using cache specific constructors
  * aio-libs#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()`
  • Loading branch information
padraic-shafer committed Apr 24, 2022
1 parent 02782c2 commit e32dc81
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion aiocache/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit e32dc81

Please sign in to comment.