I have a Azure redis cache and sometimes I need to get all values stored, to do that I use simple iteration like that:
keys = db.keys()
for key in keys:
entry=db.get(key)
Unfortunately, the results are different if I read some of the values directly
db.get('my_key')
Why that could be the case? Additionally, when I read from redis using redis insights - I get the same result as in the hardcoded scenario.
The issue was resolved in a different way.
The root cause for this inconsistency was that there was a "duplicated" - in quotes - key. We somehow ended up with a separate entry with a trailing space at the end:
db.get('my_key')
db.get('my_key ')