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

Function RM_StringSet

src/module.cpp:2540–2546  ·  view source on GitHub ↗

If the key is open for writing, set the specified string 'str' as the * value of the key, deleting the old value if any. * On success REDISMODULE_OK is returned. If the key is not open for * writing or there is an active iterator, REDISMODULE_ERR is returned. */

Source from the content-addressed store, hash-verified

2538 * On success REDISMODULE_OK is returned. If the key is not open for
2539 * writing or there is an active iterator, REDISMODULE_ERR is returned. */
2540int RM_StringSet(RedisModuleKey *key, RedisModuleString *str) {
2541 if (!(key->mode & REDISMODULE_WRITE) || key->iter) return REDISMODULE_ERR;
2542 RM_DeleteKey(key);
2543 genericSetKey(key->ctx->client,key->db,key->key,str,0,0);
2544 key->value = str;
2545 return REDISMODULE_OK;
2546}
2547
2548/* Prepare the key associated string value for DMA access, and returns
2549 * a pointer and size (by reference), that the user can use to read or

Callers

nothing calls this directly

Calls 2

RM_DeleteKeyFunction · 0.85
genericSetKeyFunction · 0.85

Tested by

no test coverage detected