bluememo

Sweep

Clears room, and only when there is no room left.

func (store *Store) Sweep(ctx context.Context) (SweepReport, error)
  1. Memories past their expiry go cold.
  2. Static memories beyond StaticShare of Capacity lose the static flag, weakest first. They stay in the store.
  3. While live memories exceed Capacity, the least useful origins go cold together. An origin that holds a static memory within its quota is left alone.
  4. While stored memories exceed Capacity, cold memories older than ColdGrace are deleted: superseded first, then expired, then pressure, least useful first within each.
  5. Tombstones beyond TombstoneCapacity are pruned, oldest first.

A sweep with headroom deletes nothing, however old or cold its memories are. Deleting when there is room is pure loss.