I needed to check if the Redis client in our Rails application was namespacing
keys correctly on certain commands. Instead of adding some debugging code on the
Rails side to see what keys were being used, I chose to look at my local Redis
server instead. If I saw any key without the app:development
prefix, I knew
the issue was still present.
Using the MONITOR command and the redis-cli program, I was able to watch in real-time all the commands that were being sent to the server.
❯ redis-cli MONITOR
OK
1614720201.775951 [0 127.0.0.1:62649] "exists" "session:abc123"
1614720201.776312 [0 127.0.0.1:62649] "get" "app:development:session:abc123"
1614720202.509717 [0 127.0.0.1:62649] "setex" "app:development:session:abc123" "2592000" "<a bunch of data>"
The return values of the MONITOR command is a direct dump of the commands the
server has received. It shows the timestamp, database, and connection info along
with the command and arguments. Seeing the EXISTS command requesting a key
without the prefix let me know I still had work to do. I could try new
approaches without stopping the redis-cli
program until I saw the desired
change.