A TTL rescan that finds the same files reuses the previous values and sort orders; one that finds a few changes rebuilds only those files. Gallery invalidation and a gallery-roots change drop the derived values, so old roots no longer hold memory. category is trimmed like tags.