Skip to content

Commit 4d83df3

Browse files
committed
small lru cache for fetches
1 parent 15dc521 commit 4d83df3

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎src/crate_builder_script/api_calls.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
from pprint import pformat
55
from typing import Any
6+
from functools import lru_cache
67

78
import requests
89

@@ -19,6 +20,7 @@
1920
HUBMAP_ORG_ENTITY = HUBMAP # for lack of a better choice
2021

2122

23+
@lru_cache(maxsize=8)
2224
def fetch_entity_info(target_id: str) -> dict[str, Any]:
2325
"""Fetch a dataset's entity information."""
2426
LOGGER.debug("FETCH %s", target_id)
@@ -57,6 +59,7 @@ def fetch_entity_info(target_id: str) -> dict[str, Any]:
5759
return ds_info
5860

5961

62+
@lru_cache(maxsize=8)
6063
def fetch_uuid_files_info(target_id: str) -> dict[str, Any]:
6164
"""Fetch files informaion from the UUID API."""
6265
resp = requests.get(

0 commit comments

Comments
 (0)