MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / setCommand

Function setCommand

src/t_string.cpp:264–275  ·  view source on GitHub ↗

SET key value [NX] [XX] [KEEPTTL] [GET] [EX ] [PX ] * [EXAT ][PXAT ] */

Source from the content-addressed store, hash-verified

262/* SET key value [NX] [XX] [KEEPTTL] [GET] [EX <seconds>] [PX <milliseconds>]
263 * [EXAT <seconds-timestamp>][PXAT <milliseconds-timestamp>] */
264void setCommand(client *c) {
265 robj *expire = NULL;
266 int unit = UNIT_SECONDS;
267 int flags = OBJ_NO_FLAGS;
268
269 if (parseExtendedStringArgumentsOrReply(c,&flags,&unit,&expire,COMMAND_SET) != C_OK) {
270 return;
271 }
272
273 c->argv[2] = tryObjectEncoding(c->argv[2]);
274 setGenericCommand(c,flags,c->argv[1],c->argv[2],expire,unit,NULL,NULL);
275}
276
277void setnxCommand(client *c) {
278 c->argv[2] = tryObjectEncoding(c->argv[2]);

Callers

nothing calls this directly

Calls 3

tryObjectEncodingFunction · 0.85
setGenericCommandFunction · 0.85

Tested by

no test coverage detected