AuroraMeter. Flusher
(Aurora Meter v0.1.0)
View Source
Periodically persists dirty ETS counters to the database.
Each cycle snapshots the dirty-key set and, per key, deletes the dirty mark, reads the current ETS value, and batches an absolute-value upsert. Deleting per key (not the whole table) means a key re-marked mid-sweep survives to the next cycle; absolute-value upserts make repeated flushes idempotent.
Summary
Functions
Returns a specification to start this module under a supervisor.
Flushes dirty counters now, returning the number persisted.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec flush() :: {:ok, non_neg_integer()}
Flushes dirty counters now, returning the number persisted.