summaryrefslogtreecommitdiff
path: root/tests/integration/aof.tcl
diff options
context:
space:
mode:
authorRaghav Muddur <r@nmvk.com>2021-01-27 09:47:26 -0800
committerGitHub <noreply@github.com>2021-01-27 19:47:26 +0200
commit0367a80819dec9aeb5e3d0972535155fc1c48867 (patch)
tree5badd47fa6c6cb648ec90cbe11c9333581ed9a5e /tests/integration/aof.tcl
parentf395119eded8294e80918331ebc4948eb5e5e006 (diff)
downloadredis-0367a80819dec9aeb5e3d0972535155fc1c48867.tar.gz
GETEX, GETDEL and SET PXAT/EXAT (#8327)
This commit introduces two new command and two options for an existing command GETEX <key> [PERSIST][EX seconds][PX milliseconds] [EXAT seconds-timestamp] [PXAT milliseconds-timestamp] The getexCommand() function implements extended options and variants of the GET command. Unlike GET command this command is not read-only. Only one of the options can be used at a given time. 1. PERSIST removes any TTL associated with the key. 2. EX Set expiry TTL in seconds. 3. PX Set expiry TTL in milliseconds. 4. EXAT Same like EX instead of specifying the number of seconds representing the TTL (time to live), it takes an absolute Unix timestamp 5. PXAT Same like PX instead of specifying the number of milliseconds representing the TTL (time to live), it takes an absolute Unix timestamp Command would return either the bulk string, error or nil. GETDEL <key> Would delete the key after getting. SET key value [NX] [XX] [KEEPTTL] [GET] [EX <seconds>] [PX <milliseconds>] [EXAT <seconds-timestamp>][PXAT <milliseconds-timestamp>] Two new options added here are EXAT and PXAT Key implementation notes - `SET` with `PX/EX/EXAT/PXAT` is always translated to `PXAT` in `AOF`. When relative time is specified (`PX/EX`), replication will always use `PX`. - `setexCommand` and `psetexCommand` would no longer need translation in `feedAppendOnlyFile` as they are modified to invoke `setGenericCommand ` with appropriate flags which will take care of correct AOF translation. - `GETEX` without any optional argument behaves like `GET`. - `GETEX` command is never propagated, It is either propagated as `PEXPIRE[AT], or PERSIST`. - `GETDEL` command is propagated as `DEL` - Combined the validation for `SET` and `GETEX` arguments. - Test cases to validate AOF/Replication propagation
Diffstat (limited to 'tests/integration/aof.tcl')
-rw-r--r--tests/integration/aof.tcl11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/integration/aof.tcl b/tests/integration/aof.tcl
index d81521374..e64e2022a 100644
--- a/tests/integration/aof.tcl
+++ b/tests/integration/aof.tcl
@@ -272,4 +272,15 @@ tags {"aof"} {
}
}
}
+
+ start_server {overrides {appendonly {yes} appendfilename {appendonly.aof}}} {
+ test {GETEX should not append to AOF} {
+ set aof [file join [lindex [r config get dir] 1] appendonly.aof]
+ r set foo bar
+ set before [file size $aof]
+ r getex foo
+ set after [file size $aof]
+ assert_equal $before $after
+ }
+ }
}