"Touch" a key, so that if this key is being WATCHed by some client the * next EXEC will fail. */
| 370 | /* "Touch" a key, so that if this key is being WATCHed by some client the |
| 371 | * next EXEC will fail. */ |
| 372 | void 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: |
no test coverage detected