I tried the following commands but they all fail with syntax error

SET test-key test-value KEEPTTL
SET test-key test-value "KEEPTTL"
SET test-key test-value EX 100000 KEEPTTL
SET test-key test-value EX 100000 "KEEPTTL"

Comment From: oranagra

The first one seems right..

redis> Set a b ex 10000
"OK"
redis> TTL a
(integer) 9980
redis> Set a 1
"OK"
redis> TTL a
(integer) -1
redis> Set a b ex 1000
"OK"
redis> TTL a
(integer) 994
redis> Set a 1 keepttl
"OK"
redis> TTL a
(integer) 975

Comment From: no-name420

The first one seems right..

redis> Set a b ex 10000 "OK" redis> TTL a (integer) 9980 redis> Set a 1 "OK" redis> TTL a (integer) -1 redis> Set a b ex 1000 "OK" redis> TTL a (integer) 994 redis> Set a 1 keepttl "OK" redis> TTL a (integer) 975

Thanks for the help, turns out I made rookie's mistake by having multiple instances of redis running on my machine... One instance was the windows archive installation (redis version 3) and the other one was redis version 6 via WSL, and the client was automatically connecting to the version 3 server which doesn't support KEEPTTL...