Helper function for the activeExpireCycle() function. * This function will try to expire the key that is stored in the hash table * entry 'de' of the 'expires' hash table of a Redis database. * * If the key is found to be expired, it is removed from the database and * 1 is returned. Otherwise no operation is performed and 0 is returned. * * When a key is expired, g_pserver->stat_expiredkeys
| 45 | * The parameter 'now' is the current time in milliseconds as is passed |
| 46 | * to the function to avoid too many gettimeofday() syscalls. */ |
| 47 | void activeExpireCycleExpireFullKey(redisDb *db, const char *key) { |
| 48 | robj *keyobj = createStringObject(key,sdslen(key)); |
| 49 | mstime_t expire_latency; |
| 50 | |
| 51 | propagateExpire(db,keyobj,g_pserver->lazyfree_lazy_expire); |
| 52 | latencyStartMonitor(expire_latency); |
| 53 | if (g_pserver->lazyfree_lazy_expire) |
| 54 | dbAsyncDelete(db,keyobj); |
| 55 | else |
| 56 | dbSyncDelete(db,keyobj); |
| 57 | latencyEndMonitor(expire_latency); |
| 58 | latencyAddSampleIfNeeded("expire-del",expire_latency); |
| 59 | notifyKeyspaceEvent(NOTIFY_EXPIRED, |
| 60 | "expired",keyobj,db->id); |
| 61 | signalModifiedKey(NULL, db, keyobj); |
| 62 | decrRefCount(keyobj); |
| 63 | g_pserver->stat_expiredkeys++; |
| 64 | } |
| 65 | |
| 66 | /*----------------------------------------------------------------------------- |
| 67 | * Incremental collection of expired keys. |
no test coverage detected