Skip to content

Commit

Permalink
resources: extract LRU cache type
Browse files Browse the repository at this point in the history
Signed-off-by: flashdagger <flashdagger@googlemail.com>
  • Loading branch information
flashdagger committed Nov 26, 2023
1 parent 3eb412b commit f236c00
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions zammadoo/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
_ = Resource # make PyCharm happy

_T_co = TypeVar("_T_co", bound="Resource", covariant=True)
Cache = LruCache["JsonDict"]


class ResourcesT(Generic[_T_co]):
Expand All @@ -42,9 +43,7 @@ class ResourcesT(Generic[_T_co]):
def __init__(self, client: "Client", endpoint: str):
self._client = weakref.ref(client)
self.endpoint: str = endpoint
self.cache = LruCache["JsonDict"](
max_size=self.DEFAULT_CACHE_SIZE
) #: resource LRU cache
self.cache = Cache(max_size=self.DEFAULT_CACHE_SIZE) #: resource LRU cache

def __call__(self, rid: int, *, info: Optional["JsonDict"] = None) -> _T_co:
if info:
Expand Down

0 comments on commit f236c00

Please sign in to comment.