From 20eeddfb8a8840aff8ac9e54a69650890d9c1e64 Mon Sep 17 00:00:00 2001 From: antirez Date: Fri, 14 Feb 2020 18:22:25 +0100 Subject: [PATCH] Signal key as modified when expired on-access. This fixes WATCH and client side caching with keys expiring because of a synchronous access and not because of background expiring. --- src/db.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/db.c b/src/db.c index c80524e94..8a0242d9e 100644 --- a/src/db.c +++ b/src/db.c @@ -1296,8 +1296,10 @@ int expireIfNeeded(redisDb *db, robj *key) { propagateExpire(db,key,server.lazyfree_lazy_expire); notifyKeyspaceEvent(NOTIFY_EXPIRED, "expired",key,db->id); - return server.lazyfree_lazy_expire ? dbAsyncDelete(db,key) : - dbSyncDelete(db,key); + int retval = server.lazyfree_lazy_expire ? dbAsyncDelete(db,key) : + dbSyncDelete(db,key); + if (retval) signalModifiedKey(db,key); + return retval; } /* -----------------------------------------------------------------------------