form_cache module¶
- class CacheEntry(entry, time_to_live)¶
Bases:
object- Parameters:
entry (Table)
time_to_live (float)
- entry: Table¶
- time_to_live: float¶
- class FormGetterCached¶
Bases:
object- classmethod clean_cache()¶
- data: dict[str, CacheEntry] = {}¶
- classmethod evict(refnr, table)¶
Drop the cached form for
(table, refnr)so the next read is fresh.Call this after a write: because
get_table()now returns a materialized snapshot, an un-evicted entry would serve stale values for up to theget_formTTL after an edit.- Return type:
None- Parameters:
refnr (str)
table (str)
- classmethod get_form(refnr, period, settings)¶
- Return type:
Table- Parameters:
refnr (str)
period (str)
settings (EditorSettings)
- static get_table(refnr, period, settings)¶
Materialize the whole refnr-filtered form in ONE query.
The per-field
default_getterre-filters this result once per editable field (~48 for RA-0255). Returning a lazy Postgres expression here means each of those re-filters is a separate database round-trip on every refnr change – the dominant cost of loading the data editor.Instead we execute a single query for the whole refnr-filtered form and return an in-memory
ibis.memtable. The subsequent per-field filter/select then run entirely in-process (DuckDB) with no further database round-trips.get_formcaches this materialized table; writes evict it viaevict()so reads stay fresh.- Return type:
Table- Parameters:
refnr (str)
period (str)
settings (EditorSettings)