I am generating a key that will expire in Redis. As a programming language, I am using Go. The problem is that I need to know when something expires, because based on that, I know which key is expiring or what data it contains, and I can know when it is no longer in Redis. How can I listen for the expiration event using Golang? I have seen examples in TypeScript but not in Golang
This is my code to set an expiring key
<code>func (r *Redis) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) error {
return r.Client.Set(ctx, key, value, expiration).Err()
}
</code>
<code>func (r *Redis) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) error {
return r.Client.Set(ctx, key, value, expiration).Err()
}
</code>
func (r *Redis) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) error {
return r.Client.Set(ctx, key, value, expiration).Err()
}