add parameter "filter" to the "flush" method