Expand description
ID cache — maps chat identifiers and npubs to SQLite row IDs.
All lookups are cached in memory after first DB hit. Caches are preloaded at boot and cleared on account switch.
Functions§
- clear_
id_ caches - Clear all ID caches (call on account switch).
- forget_
chat_ id - Drop a chat’s cached identifier→id mapping. Call after deleting a chat row so a later recreate doesn’t reuse the stale (now-deleted) integer id.
- get_
chat_ id_ by_ identifier - Lookup-only: get integer chat ID from identifier. Errors if not found.
- get_
or_ create_ chat_ id - Get or create integer chat ID from identifier.
- get_
or_ create_ user_ id - Get or create integer user ID from npub. Returns None for empty npub.
- preload_
id_ caches - Preload all ID mappings into memory cache (call at boot).