5

I followed this guide Redis Key expire notification with Jedis to listen expired key. But i don't know how to get its expired value.

Is there a way to get value of the expired key ?

Please help. Thank you!

Community
  • 1
  • 1
Vunb
  • 484
  • 8
  • 34

1 Answers1

2

No, there isn't. All keyspace notifications, expiry events included, do not provide the values of the keys.

Itamar Haber
  • 47,336
  • 7
  • 91
  • 117
  • Thank you for your answer! I think of using hashmap to keep the values of the keys. Do you have any suggestions ? – Vunb Mar 24 '16 at 13:43
  • 1
    In Spring Data Redis we write a phantom value (actual a copy) with a longer timeout and listen to expiry keyspace events (need to be activated, see http://redis.io/topics/notifications#configuration). As soon the original key expires we get notified and read the phantom object so we have access to the copy of the value. – mp911de Mar 24 '16 at 13:53
  • Please edit your question to add more details - most importantly why you need the expired values. – Itamar Haber Mar 24 '16 at 13:53
  • 1
    Kudos to @christoph-strobl, that was his idea. – mp911de Mar 24 '16 at 13:55