Watch
1
0
Fork
You've already forked query-rse-group
0
query-rse-group/query_things/cache.py
Michael Hanke 254092edf2
rf: trim unnecessary features/complexity from caching
The CLI command was needlessly flexible. Remove toleration
of invalid inputs.

This allowed for a simplified caching.

Again the JSON lines handling is now constrained to the CLI.
2026-09-01 06:53:15 +02:00

15 lines
382 B
Python

from query_things.common import (
Record,
RecordCache,
)
def cache_record(record: Record, cache: RecordCache) -> Record:
"""Store JSON record in `cache`, passing it through.
A record that does not have a 'pid' key is silently ignored
by the cache, but is still returned.
"""
if 'pid' in record:
cache[record['pid']] = record
return record