Skip to content

System generated set redis key api

  • Create new redis keys and set its value.
  • 'ttl' is the validity time in 'seconds' of the added key.

Request Method: POST

URL

/api/system-api/user-path/set-redis-key

Request payload

[
    {
        "key": "redis_key_name",
        "value": "redis_key_value",
        "ttl": 60
    },
    {
        "key": "redis_key_name",
        "value": "redis_key_value",
        "ttl": 60
    }
]

Set redis keys

Set redis key using global object 'g'.

await g.sys.cache.setKey([
    {
        key: "redis_key_name",
        value: "redis_key_value",
        ttl: 1500  // This key will be available till next 1500 seconds.
    },
    {
        key: "redis_key_name",
        value: "redis_key_value"
    }
]);

Response payload

1
2
3
4
5
{
    "success": true,
    "statusCode": 200,
    "data": true
}