There is no such thing as an empty list in Redis, if a list is RPOP'ed all the way, the key is deleted.
So, one of these should be happening:
- The list
mylist
is getting emptied (LPOP, RPOP, LREM, LTRIM, etc) all the way until empty.
- The key
mylist
is being deleted (DEL, UNLINK, etc)
- The key
mylist
is being expired (EXPIRE, EXPIREAT, etc)
- The key is being evicted
- Data loss is occurring
If no redis-client is touching the key (1-3), then it must be 4 or 5.
See if you have some eviction policy set in your server with CONFIG GET maxmemory-policy
.
Data loss may be occurring if you have no persistence and your server is restarted. Or if you are using more than a single instance (cluster or sentinel) and something is wrong. You can use the INFO
command to see:
- Server section:
redis_mode
and uptime_in_days
.
- Persistance section: relevant if uptime suggests the server restarted by the time you lost a key.
- Memory & Stats sections:
maxmemory_policy
and evicted_keys
will tell us if a policy is being applied
- Replication & Cluster sections: if we still have no clue, start investigating this venue.