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

Function touchWatchedKey

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

"Touch" a key, so that if this key is being WATCHed by some client the * next EXEC will fail. */

Source from the content-addressed store, hash-verified

370/* "Touch" a key, so that if this key is being WATCHed by some client the
371 * next EXEC will fail. */
372void touchWatchedKey(redisDb *db, robj *key) {
373 list *clients;
374 listIter li;
375 listNode *ln;
376
377 if (dictSize(db->watched_keys) == 0) return;
378 clients = dictFetchValue(db->watched_keys, key);
379 if (!clients) return;
380
381 /* Mark all the clients watching this key as CLIENT_DIRTY_CAS */
382 /* Check if we are already watching for this key */
383 listRewind(clients,&li);
384 while((ln = listNext(&li))) {
385 client *c = listNodeValue(ln);
386
387 c->flags |= CLIENT_DIRTY_CAS;
388 }
389}
390
391/* Set CLIENT_DIRTY_CAS to all clients of DB when DB is dirty.
392 * It may happen in the following situations:

Callers 1

signalModifiedKeyFunction · 0.85

Calls 3

dictFetchValueFunction · 0.85
listRewindFunction · 0.85
listNextFunction · 0.85

Tested by

no test coverage detected