Return the key expire value, as milliseconds of remaining TTL. * If no TTL is associated with the key or if the key is empty, * REDISMODULE_NO_EXPIRE is returned. */
| 2359 | * If no TTL is associated with the key or if the key is empty, |
| 2360 | * REDISMODULE_NO_EXPIRE is returned. */ |
| 2361 | mstime_t RM_GetExpire(RedisModuleKey *key) { |
| 2362 | mstime_t expire = getExpire(key->db,key->key); |
| 2363 | if (expire == -1 || key->value == NULL) |
| 2364 | return REDISMODULE_NO_EXPIRE; |
| 2365 | expire -= mstime(); |
| 2366 | return expire >= 0 ? expire : 0; |
| 2367 | } |
| 2368 | |
| 2369 | /* Set a new expire for the key. If the special expire |
| 2370 | * REDISMODULE_NO_EXPIRE is set, the expire is cancelled if there was |