Skip to content

Commit b04eebe

Browse files
committed
fix docString
1 parent 0c18eac commit b04eebe

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/daq_config_server/client.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,20 @@ def __init__(
1414
url: str,
1515
log: Logger | None = None,
1616
cache_size: int = 10,
17-
cache_lifetime: int = 3600,
17+
cache_lifetime_s: int = 3600,
1818
) -> None:
1919
"""
2020
Initialize the ConfigServer client.
2121
2222
Args:
2323
url: Base URL of the config server.
2424
log: Optional logger instance.
25+
cache_size: Size of the cache (maximum number of items can be stored).
26+
cache_lifetime: Lifetime of the cache (in seconds).
2527
"""
2628
self._url = url.rstrip("/")
2729
self._log = log if log else getLogger("daq_config_server.client")
28-
self._cache = TTLCache(maxsize=cache_size, ttl=cache_lifetime)
30+
self._cache = TTLCache(maxsize=cache_size, ttl=cache_lifetime_s)
2931

3032
def _get(
3133
self,
@@ -34,13 +36,11 @@ def _get(
3436
reset_cached_result: bool = False,
3537
) -> Any:
3638
"""
37-
Internal method to get data from the cache config server, with cache
38-
management.
39-
This method checks if the data is already cached. If it is, it returns
40-
the cached data. If not, it fetches the data from the config server,
41-
caches it, and returns the data.
42-
If reset_cached_result is True, it will remove the cached data and
43-
fetch it again from the config server.
39+
Get data from the config server with cache management.
40+
If a cached response doesn't already exist, makes a request to
41+
the config server.
42+
If reset_cached_result is true, remove the cache entry for that request and
43+
make a new request
4444
4545
Args:
4646
endpoint: API endpoint.

tests/unit_tests/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def test_read_unformatted_file_cache_custom_lifetime(mock_request: MagicMock):
108108
]
109109
file_path = "test"
110110
url = "url"
111-
server = ConfigServer(url=url, cache_lifetime=0.1) # type: ignore
111+
server = ConfigServer(url=url, cache_lifetime_s=0.1) # type: ignore
112112
assert server.read_unformatted_file(file_path) == "1st_read"
113113
assert server.read_unformatted_file(file_path) == "1st_read"
114114
sleep(0.1)

0 commit comments

Comments
 (0)