Drupal 8 currentUser wrong data

If I login with some user I get other uid from the code below, I dont know what happen I have to clear the cache all time.

example, if i login with john (user id is 6 the code below return the uid for the last user logged before)

$uid = Drupal::currentUser()->id();

how can i fix this problem

Maybe i have to clear the cache for the user

Drupal version: 

Source: https://www.drupal.org/taxonomy/term/2/feed