Every in-memory-database assessment starts from this model: a record named by a string key, holding fields that map to string values. Build RecordStore with:
set(key, field, value): write the field, creating the record if needed.get(key, field) -> str | None: the value, orNoneif missing. Never raises, never creates anything.delete(key, field) -> bool: remove the field (True), orFalseif it wasn't there. A record with no fields left is gone.fields(key) -> list[str]: the record's field names, sorted;[]if missing.count() -> int: how many records exist.
s = RecordStore()
s.set("user1", "name", "Ann")
s.set("user1", "city", "Oslo")
s.get("user1", "name") # "Ann"
s.get("user2", "name") # None
s.fields("user1") # ["city", "name"]
s.delete("user1", "name") # True
s.delete("user1", "name") # False
s.delete("user1", "city") # True
s.count() # 0: user1 has no fields left
Show hint
a dict of dicts (key -> {field: value}), read with .get(...); delete the inner dict when it empties.