Home > front end >  RedisJSON add TTL on specific Value in JSON Object
RedisJSON add TTL on specific Value in JSON Object

Time:10-21

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 });

CodePudding user response:

You cannot set TTL on an inner element of a RedisJSON object.

Note: It can be done only on an entire RedisJSON object.

CodePudding user response:

NX and XX are the only valid enter image description here

  • Related