forked from orinoco/query-things
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.
15 lines
382 B
Python
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
|