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

Function isWatchedKeyExpired

src/multi.cpp:362–374  ·  view source on GitHub ↗

iterates over the watched_keys list and * look for an expired key . */

Source from the content-addressed store, hash-verified

360/* iterates over the watched_keys list and
361 * look for an expired key . */
362int isWatchedKeyExpired(client *c) {
363 listIter li;
364 listNode *ln;
365 watchedKey *wk;
366 if (listLength(c->watched_keys) == 0) return 0;
367 listRewind(c->watched_keys,&li);
368 while ((ln = listNext(&li))) {
369 wk = (watchedKey*)listNodeValue(ln);
370 if (keyIsExpired(wk->db, wk->key)) return 1;
371 }
372
373 return 0;
374}
375
376/* "Touch" a key, so that if this key is being WATCHed by some client the
377 * next EXEC will fail. */

Callers 1

execCommandFunction · 0.85

Calls 3

listRewindFunction · 0.85
listNextFunction · 0.85
keyIsExpiredFunction · 0.85

Tested by

no test coverage detected