Redis notifications: Get key and value on expiration

后端 未结 3 459
清酒与你
清酒与你 2021-01-30 14:45

we have the following use case: Every time a certain key expires, we need to get notified and do something, based on it\'s value. But when redis fires the expired e

3条回答
  •  没有蜡笔的小新
    2021-01-30 14:59

    I would suggest you to include the relevant value that you need as part of the key. For example if your value is an object with few properties (like userId,date,etc) And if it's enough for you to know the userId when it's expired - So you can create a key like this: someGuid_userId Then extract it in the event handler when expired

提交回复
热议问题