dragonflydb / dragonfly

A modern replacement for Redis and Memcached
https://www.dragonflydb.io/
Other
25.96k stars 954 forks source link

HEXPIRE - key is not removed until HGET / HGETALL is called #4097

Open draftpin opened 1 week ago

draftpin commented 1 week ago

Describe the bug If you set HEXPIRE on key, then it is not removed automatically until HGET / HGETALL is called

To Reproduce Steps to reproduce the behavior:

redis-cli
HSET testSet test testValue
HEXPIRE testSet 5 FIELDS 1 test
(integer) 1
HLEN testSet
(integer) 1
HLEN testSet
(integer) 1
HLEN testSet
(integer) 1
... will show 1 infinitely until HGET / HGETALL will called
HGETALL testSet
(empty array) 
HLEN testSet
(integer) 0

Expected behavior Should automatically remove key when timeout is triggered, after that HLEN should return 0

Screenshots No need, easy to reproduce

Environment (please complete the following information):

Reproducible Code Snippet

# See above

Additional context On native Redis server (redis_version:7.4.1) there is no such problem:

127.0.0.1:6379> HSET testSet test testValue
(integer) 1
127.0.0.1:6379> HEXPIRE testSet 5 FIELDS 1 test
1) (integer) 1
127.0.0.1:6379> HLEN testSet
(integer) 1
127.0.0.1:6379> HLEN testSet
(integer) 1
127.0.0.1:6379> HLEN testSet
(integer) 1
127.0.0.1:6379> HLEN testSet
(integer) 0
127.0.0.1:6379> HLEN testSet
(integer) 0
kostasrim commented 1 week ago

Hi @draftpin, thank you for reporting. That's a limitation of the current implication and I am not sure when this will be planned.

cc @romange