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

Function moduleCloseKey

src/module.cpp:2354–2369  ·  view source on GitHub ↗

Destroy a RedisModuleKey struct (freeing is the responsibility of the caller). */

Source from the content-addressed store, hash-verified

2352
2353/* Destroy a RedisModuleKey struct (freeing is the responsibility of the caller). */
2354static void moduleCloseKey(RedisModuleKey *key) {
2355 int signal = SHOULD_SIGNAL_MODIFIED_KEYS(key->ctx);
2356 moduleAcquireGIL(false);
2357 if ((key->mode & REDISMODULE_WRITE) && signal)
2358 signalModifiedKey(key->ctx->client,key->db,key->key);
2359 /* TODO: if (key->iter) RM_KeyIteratorStop(kp); */
2360 moduleReleaseGIL(false);
2361 if (key->iter) zfree(key->iter);
2362 RM_ZsetRangeStop(key);
2363 if (key && key->value && key->value->type == OBJ_STREAM &&
2364 key->u.stream.signalready) {
2365 /* One of more RM_StreamAdd() have been done. */
2366 signalKeyAsReady(key->db, key->key, OBJ_STREAM);
2367 }
2368 decrRefCount(key->key);
2369}
2370
2371/* Close a key handle. */
2372void RM_CloseKey(RedisModuleKey *key) {

Callers 2

RM_CloseKeyFunction · 0.85
moduleScanCallbackFunction · 0.85

Calls 7

moduleAcquireGILFunction · 0.85
signalModifiedKeyFunction · 0.85
moduleReleaseGILFunction · 0.85
zfreeFunction · 0.85
RM_ZsetRangeStopFunction · 0.85
signalKeyAsReadyFunction · 0.85
decrRefCountFunction · 0.85

Tested by

no test coverage detected