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

Function setExpire

app/redis-6.2.6/src/db.c:1412–1424  ·  view source on GitHub ↗

Set an expire to the specified key. If the expire is set in the context * of an user calling a command 'c' is the client, otherwise 'c' is set * to NULL. The 'when' parameter is the absolute unix time in milliseconds * after which the key will no longer be considered valid. */

Source from the content-addressed store, hash-verified

1410 * to NULL. The 'when' parameter is the absolute unix time in milliseconds
1411 * after which the key will no longer be considered valid. */
1412void setExpire(client *c, redisDb *db, robj *key, long long when) {
1413 dictEntry *kde, *de;
1414
1415 /* Reuse the sds from the main dict in the expire dict */
1416 kde = dictFind(db->dict,key->ptr);
1417 serverAssertWithInfo(NULL,key,kde != NULL);
1418 de = dictAddOrFind(db->expires,dictGetKey(kde));
1419 dictSetSignedIntegerVal(de,when);
1420
1421 int writable_slave = server.masterhost && server.repl_slave_ro == 0;
1422 if (c && writable_slave && !(c->flags & CLIENT_MASTER))
1423 rememberSlaveKeyWithExpire(db,key);
1424}
1425
1426/* Return the expire time of the specified key, or -1 if no expire
1427 * is associated with this key (i.e. the key is non volatile) */

Callers 10

expireGenericCommandFunction · 0.85
setGenericCommandFunction · 0.85
getexCommandFunction · 0.85
rdbLoadRioFunction · 0.85
renameGenericCommandFunction · 0.85
moveCommandFunction · 0.85
copyCommandFunction · 0.85
restoreCommandFunction · 0.85
RM_SetExpireFunction · 0.85
RM_SetAbsExpireFunction · 0.85

Calls 3

dictAddOrFindFunction · 0.85
dictFindFunction · 0.70

Tested by

no test coverage detected