Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does `expires` in redis `info keyspace` output mean?

Tags:

redis

info keyspace in Redis gives output like:

db0:keys=XXX,expires=YYY

What does expires mean in this? I'm not able to find any documentation for it? Does it mean the number of keys for which the expiry is set?

like image 286
Hitesh Sharma Avatar asked Jan 08 '15 19:01

Hitesh Sharma


People also ask

What is expire in Redis?

When a key has an expire set, Redis will make sure to remove the key when the specified amount of time elapsed. The key time to live can be updated or entirely removed using the EXPIRE and PERSIST command (or other strictly related commands).

What is Keyspace in Redis?

Redis keyspace notifications allow you to subscribe to PubSub channels. Through the channel, clients receive published events when a Redis command or data alteration occurs. These notifications are useful when an application must respond to changes that occur to the value stored in a particular key or keys.

How do I expire a list in Redis?

As noted in the accepted answer, expiration in Redis is only performed at key-level - nested elements cannot be expired. To "expire" items, call ZREMRANGEBYSCORE from -inf and the current epoch minus 24 hours.


1 Answers

Yes, it shows the number of keys that will expire at some point in the future.

like image 82
Barış Uşaklı Avatar answered Sep 21 '22 20:09

Barış Uşaklı