def flush(now)
      if now || @entries.length > WATERMARK
        @entries.each do |e|
          if e.modified
            e.obj.save
            e.modified = false
          end
        end

        # Delete all but the first WATERMARK entry.
        @entries = @entries[0..WATERMARK - 1] if @entries.length > WATERMARK
      end
    end
def flush(now)
      if now || @entries.length > WATERMARK
        @entries.each do |e|
          if e.modified
            e.obj.save
            e.modified = false
          end
        end

        # Delete all but the first WATERMARK entry.
        @entries = @entries[0..WATERMARK - 1] if @entries.length > WATERMARK
      end
    end
Save all modified entries and delete all but the most recently added.