Encoder + Bounce2 Library
The ClickEncoder library works very well with the Keyes rotary encoder: https://github.com/0xPIT/encoder. The Button reports multiple states: Clicked, DoubleClicked, Held and Released. It uses analog pins A1, A0, A2. You will also need the TimerOne library: https://code.google.com/archive/p/arduino-timerone/downloads.

My keyes rotary encoders have 3 surface mount resistor locations on the bottom of the circuit board. R1 has nothing, R2 and R3 have a 10k ohm resistor soldered in place. Not sure if this makes a difference.