MCPcopy Create free account
hub / github.com/F-Stack/f-stack / unwatchAllKeys

Function unwatchAllKeys

app/redis-6.2.6/src/multi.c:328–352  ·  view source on GitHub ↗

Unwatch all the keys watched by this client. To clean the EXEC dirty * flag is up to the caller. */

Source from the content-addressed store, hash-verified

326/* Unwatch all the keys watched by this client. To clean the EXEC dirty
327 * flag is up to the caller. */
328void unwatchAllKeys(client *c) {
329 listIter li;
330 listNode *ln;
331
332 if (listLength(c->watched_keys) == 0) return;
333 listRewind(c->watched_keys,&li);
334 while((ln = listNext(&li))) {
335 list *clients;
336 watchedKey *wk;
337
338 /* Lookup the watched key -> clients list and remove the client
339 * from the list */
340 wk = listNodeValue(ln);
341 clients = dictFetchValue(wk->db->watched_keys, wk->key);
342 serverAssertWithInfo(c,NULL,clients != NULL);
343 listDelNode(clients,listSearchKey(clients,c));
344 /* Kill the entry at all if this was the only client */
345 if (listLength(clients) == 0)
346 dictDelete(wk->db->watched_keys, wk->key);
347 /* Remove this watched key from the client->watched list */
348 listDelNode(c->watched_keys,ln);
349 decrRefCount(wk->key);
350 zfree(wk);
351 }
352}
353
354/* iterates over the watched_keys list and
355 * look for an expired key . */

Callers 4

discardTransactionFunction · 0.85
execCommandFunction · 0.85
unwatchCommandFunction · 0.85
freeClientFunction · 0.85

Calls 8

listRewindFunction · 0.85
listNextFunction · 0.85
dictFetchValueFunction · 0.85
listDelNodeFunction · 0.85
listSearchKeyFunction · 0.85
decrRefCountFunction · 0.85
dictDeleteFunction · 0.70
zfreeFunction · 0.70

Tested by

no test coverage detected