MT#55283 set expiry time with SET

Change-Id: I99dba5f329734704882a10e062518a3aa9aec2e0
pull/1853/head
Richard Fuchs 1 year ago
parent 7bf431a1fa
commit 68ff069adc

@ -2790,8 +2790,7 @@ void redis_update_onekey(call_t *c, struct redis *r) {
if (!result.len)
goto err;
redis_pipe(r, "SET " PB " " PB, PBSTR(&c->callid), PBSTR(&result));
redis_pipe(r, "EXPIRE "PB" %i", PBSTR(&c->callid), redis_expires_s);
redis_pipe(r, "SET " PB " " PB " EX %i", PBSTR(&c->callid), PBSTR(&result), redis_expires_s);
redis_consume(r);

@ -64,8 +64,8 @@ autotest_start(qw(--config-file=none -t -1 -i foo/203.0.113.1 -i foo/2001:db8:43
my $json_exp;
$NGCP::Rtpengine::req_cb = sub {
redis_io("*1\r\n\$4\r\nPING\r\n", "+PONG\r\n", "req PING");
redis_i("*3\r\n\$3\r\nSET\r\n\$" . length(cid()) . "\r\n" . cid() . "\r\n\$", "req intro");
# dumbly expect 4-digit number
redis_i("*5\r\n\$3\r\nSET\r\n\$" . length(cid()) . "\r\n" . cid() . "\r\n\$", "req intro");
# dumbly expect 4-digit number as length
my $buf;
alarm(1);
recv($redis_fd, $buf, 6, 0) or die;
@ -78,8 +78,8 @@ $NGCP::Rtpengine::req_cb = sub {
my $json = decode_json($buf);
#print Dumper($json);
like($json, $json_exp, "JSON");
redis_io("\r\n*3\r\n\$6\r\nEXPIRE\r\n\$" . length(cid()) . "\r\n" . cid() . "\r\n\$5\r\n86400\r\n",
"+OK\r\n+OK\r\n",
redis_io("\r\n\$2\r\nEX\r\n\$5\r\n86400\r\n",
"+OK\r\n",
"req EXPIRE");
};

@ -63,8 +63,8 @@ autotest_start(qw(--config-file=none -t -1 -i foo/203.0.113.1 -i foo/2001:db8:43
my $json_exp;
$NGCP::Rtpengine::req_cb = sub {
redis_io("*1\r\n\$4\r\nPING\r\n", "+PONG\r\n", "req PING");
redis_i("*3\r\n\$3\r\nSET\r\n\$" . length(cid()) . "\r\n" . cid() . "\r\n\$", "req intro");
# dumbly expect 4-digit number
redis_i("*5\r\n\$3\r\nSET\r\n\$" . length(cid()) . "\r\n" . cid() . "\r\n\$", "req intro");
# dumbly expect 4-digit number as length
my $buf;
alarm(1);
recv($redis_fd, $buf, 6, 0) or die;
@ -77,9 +77,9 @@ $NGCP::Rtpengine::req_cb = sub {
my $json = Bencode::bdecode($buf, 1);
#print Dumper($json);
like($json, $json_exp, "JSON");
redis_io("\r\n*3\r\n\$6\r\nEXPIRE\r\n\$" . length(cid()) . "\r\n" . cid() . "\r\n\$5\r\n86400\r\n",
"+OK\r\n+OK\r\n",
"req EXPIRE");
redis_io("\r\n\$2\r\nEX\r\n\$5\r\n86400\r\n",
"+OK\r\n",
"req outro");
};

Loading…
Cancel
Save