Thanks for your answer.
Yes that is one way i thought how to implement.
My only concern is that lets suppose an overflow happen while i am reading the counter and updating the variable.
as i have a bigger variable i would need to increment it somewhere inside or outside the interrupt handle.
my encoder can generate 1MHz frequency 4 edges.
it is really hard to simulate it and trying to realize if this can even happen.