1

Backstory: The keyspace of the Redis database in question reports a large amount of expired keys and memory usage is maxed out. The application using this database is experiencing (rare) intermittent timeouts and I thought (in my limited knowledge) perhaps it is because Redis is having to eject expired keys each time a new key is created.

So to my question: how do I tell Redis to remove all the expired keys?

Secondarily -- is it possible to access/see expired keys with redis-cli?

Here's a slice of the INFO I'm looking at:

maxmemory_policy:allkeys-lru
expired_keys:24326586
evicted_keys:134022997
keyspace_hits:2684031719
keyspace_misses:186380210
slave_expires_tracked_keys:0
active_defrag_key_hits:0
active_defrag_key_misses:0
db2:keys=12994468,expires=3193,avg_ttl=1891176
Neil C. Obremski
  • 18,696
  • 24
  • 83
  • 112

1 Answers1

0

Answer for myself, posterity, and any other Redis newbies out there. I was looking at the wrong "database". I was under the WRONG impression that Redis only had single table but looking at my question you see "db2". I searched into that and found that Redis can have up to 16 databases identified by a zero-based index. In this case:

SELECT 2

That selects "db2" and now doing a DBSIZE gives a more accurate output.

Oye -- so the problem is that the keys are still there! Otherwise when Redis expires a key it deletes it.

Whoops! I'm leaving my question because someone else might think to ask the same thing and be on the wrong route.

Neil C. Obremski
  • 18,696
  • 24
  • 83
  • 112