DiceDB is a redis-compliant, in-memory, real-time, and reactive database optimized for modern hardware and for building and scaling truly real-time applications.
In DiceDB, the APPEND command is currently resetting the TTL (Time to Live) of a key to -1 (no expiration) instead of preserving the existing TTL. This behavior is inconsistent with Redis, where the APPEND command does not affect the TTL of a key.
When a key with a set TTL is modified using APPEND, the TTL should continue counting down as expected, without being reset. However, in DiceDB, the TTL is being removed entirely, resulting in the key remaining indefinitely.
Impact
This issue may lead to unintended key persistence when using the APPEND command on keys that are expected to expire. It affects applications that rely on key expiration for cache management, session handling, or other use cases involving TTLs.
Steps to reproduce
Start DiceDB on port 7379.
Run the following commands using redis-cli or 'dicedb-cli':
SET key "Hello" EX 20 # Set a key with a value and a 20-second TTL
APPEND key "World" # Append to the value
TTL key # Check the TTL after append
Expected output
The expected output when the above set of commands (maybe when run on Redis)
127.0.0.1:7379> SET key "Hello" EX 20
OK
127.0.0.1:7379> APPEND key "World"
(integer) 10
127.0.0.1:7379> TTL key
(integer) 16
Observed output
The observed output when the above set of commands when run on DiceDB
127.0.0.1:7379> SET key "Hello" EX 20
OK
127.0.0.1:7379> APPEND key "World"
(integer) 10
127.0.0.1:7379> TTL key
(integer) -1 # TTL is incorrectly reset to -1 (no expiration)
Expectations for resolution
This issue will be considered resolved when the following things are done
Changes in the dice code to meet the expected behavior where the TTL is preserved after the APPEND operation.
Addition of relevant test case to ensure we catch the regression
You can find the tests under the integration_tests directory of the dice repository and the steps to run are in the README file. Refer to the following links to set up DiceDB and Redis 7.2.5 locally
Description
In DiceDB, the APPEND command is currently resetting the TTL (Time to Live) of a key to -1 (no expiration) instead of preserving the existing TTL. This behavior is inconsistent with Redis, where the APPEND command does not affect the TTL of a key.
When a key with a set TTL is modified using APPEND, the TTL should continue counting down as expected, without being reset. However, in DiceDB, the TTL is being removed entirely, resulting in the key remaining indefinitely.
Impact
This issue may lead to unintended key persistence when using the APPEND command on keys that are expected to expire. It affects applications that rely on key expiration for cache management, session handling, or other use cases involving TTLs.
Steps to reproduce
redis-cli
or 'dicedb-cli':Expected output
The expected output when the above set of commands (maybe when run on Redis)
Observed output
The observed output when the above set of commands when run on DiceDB
Expectations for resolution
This issue will be considered resolved when the following things are done
You can find the tests under the
integration_tests
directory of thedice
repository and the steps to run are in the README file. Refer to the following links to set up DiceDB and Redis 7.2.5 locally