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

Function RM_SetAbsExpire

app/redis-6.2.6/src/module.c:2409–2418  ·  view source on GitHub ↗

Set a new expire for the key. If the special expire * REDISMODULE_NO_EXPIRE is set, the expire is cancelled if there was * one (the same as the PERSIST command). * * Note that the expire must be provided as a positive integer representing * the absolute Unix timestamp the key should have. * * The function returns REDISMODULE_OK on success or REDISMODULE_ERR if * the key was not open for w

Source from the content-addressed store, hash-verified

2407 * The function returns REDISMODULE_OK on success or REDISMODULE_ERR if
2408 * the key was not open for writing or is an empty key. */
2409int RM_SetAbsExpire(RedisModuleKey *key, mstime_t expire) {
2410 if (!(key->mode & REDISMODULE_WRITE) || key->value == NULL || (expire < 0 && expire != REDISMODULE_NO_EXPIRE))
2411 return REDISMODULE_ERR;
2412 if (expire != REDISMODULE_NO_EXPIRE) {
2413 setExpire(key->ctx->client,key->db,key->key,expire);
2414 } else {
2415 removeExpire(key->db,key->key);
2416 }
2417 return REDISMODULE_OK;
2418}
2419
2420/* Performs similar operation to FLUSHALL, and optionally start a new AOF file (if enabled)
2421 * If restart_aof is true, you must make sure the command that triggered this call is not

Callers

nothing calls this directly

Calls 2

setExpireFunction · 0.85
removeExpireFunction · 0.85

Tested by

no test coverage detected