Skip to content

Commit

Permalink
Merge pull request #28 from syrusakbary/get-cache-key-override
Browse files Browse the repository at this point in the history
Support for overriding get_cache_key in subclasses
  • Loading branch information
markedwards committed Nov 14, 2022
2 parents 3b9d8bf + 3672ac3 commit b07ca57
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion aiodataloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ def __init__(
if cache is not None:
self.cache = cache

self.get_cache_key = get_cache_key or (lambda x: x)
if get_cache_key is not None:
self.get_cache_key = get_cache_key
if not hasattr(self, 'get_cache_key'):
self.get_cache_key = lambda x: x

self._cache = cache_map if cache_map is not None else {}
self._queue: List[Loader] = []
Expand Down

0 comments on commit b07ca57

Please sign in to comment.