If the key is open for writing, set the specified module type object * 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. */
| 4662 | * On success REDISMODULE_OK is returned. If the key is not open for |
| 4663 | * writing or there is an active iterator, REDISMODULE_ERR is returned. */ |
| 4664 | int RM_ModuleTypeSetValue(RedisModuleKey *key, moduleType *mt, void *value) { |
| 4665 | if (!(key->mode & REDISMODULE_WRITE) || key->iter) return REDISMODULE_ERR; |
| 4666 | RM_DeleteKey(key); |
| 4667 | robj *o = createModuleObject(mt,value); |
| 4668 | genericSetKey(key->ctx->client,key->db,key->key,o,0,0); |
| 4669 | decrRefCount(o); |
| 4670 | key->value = o; |
| 4671 | return REDISMODULE_OK; |
| 4672 | } |
| 4673 | |
| 4674 | /* Assuming RedisModule_KeyType() returned REDISMODULE_KEYTYPE_MODULE on |
| 4675 | * the key, returns the module type pointer of the value stored at key. |
nothing calls this directly
no test coverage detected