ardb
ardb copied to clipboard
Redis Inconsistencies: Hdel/expire doesn't delete the parent container when elements hit 0
I'm building unit tests for the database to gauge how well Ardb matches Redis semantics, but it seems like I'm hitting an issue where a hash container is not cleared automatically when the amount of elements hit 0, or the timeout is hit (which is default redis behavior for every container, except redis 5.0 streams).
To reproduce
> hset test a 1
> hdel test a
> exists test
shows: 1 expected: 0 (which is what redis will output)
same situation with expire:
> hset test a 1
> expire test 1
_<after a second>_
> exists 1
shows: 1 expected: 0
> keys test
shows: "test" expected: (empty list or set)
> ttl test
shows: -1 expected: -2
> hget test a
shows: 1 expected: (nil)
I hope I can work around these inconsistencies for the time being, but I would greatly appreciate a proper fix for this problem.. Willing to buy some ko-fi for you for the work ;)
- for
hset/hdel
, u need to changeredis-compatible-mode
toyes
in ardb.conf - for the issue
exists
afterexpire
, currentlyexists/keys/ttl
does not check the key expire or not, there is a background task to do the expire work. this can be improved later.