Hey working with redisJSON
NodeJS
package npm Redis 4.3.1
Key (userID):(Country) with values Json
Example
data = {
"info": {
"name":"test",
"email": "test@test,test"
},
"suppliers": {
"s1": 1,
"s2": 22
},
"suppliersCap": {
"s1": 0,
"s2": 10
}
}
redis.json.set(’22:AU’, ‘.’, data);
now I try to add TTL for 5 minutes on the specific key in the JSON
for example on this key
22:AU .data.suppliersCap.s2, after 5 minutes the cap will be 0;
bit this not works
redis.json.set(22:AU
, ‘.data.suppliersCap.s2’, {
EX: 300
});
2
Answers
You cannot set TTL on an inner element of a RedisJSON object.
Note: It can be done only on an entire RedisJSON object.
NX
andXX
are the only valid modifiers for the command: