diff options
author | antirez <antirez@gmail.com> | 2019-07-22 12:29:54 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2019-07-22 12:29:54 +0200 |
commit | 842b44dc46cc143fb28f8cadbff1fda9c81e09e2 (patch) | |
tree | 0a87f05434e6d4f9cb4c3d0e3b1501303e0d176c | |
parent | f850201c6407d5504b08f2630f525a353a7ef740 (diff) | |
download | redis-842b44dc46cc143fb28f8cadbff1fda9c81e09e2.tar.gz |
Client side caching: call the invalidation functions always.
Otherwise what happens is that the tracking table will never get garbage
collected if there are no longer clients with tracking enabled.
Now the invalidation function immediately checks if there is any table
allocated, otherwise it returns ASAP, so the overhead when the feature
is not used should be near zero.
-rw-r--r-- | src/db.c | 4 | ||||
-rw-r--r-- | src/expire.c | 2 |
2 files changed, 3 insertions, 3 deletions
@@ -412,12 +412,12 @@ long long dbTotalServerKeyCount() { void signalModifiedKey(redisDb *db, robj *key) { touchWatchedKey(db,key); - if (server.tracking_clients) trackingInvalidateKey(key); + trackingInvalidateKey(key); } void signalFlushedDb(int dbid) { touchWatchedKeysOnFlush(dbid); - if (server.tracking_clients) trackingInvalidateKeysOnFlush(dbid); + trackingInvalidateKeysOnFlush(dbid); } /*----------------------------------------------------------------------------- diff --git a/src/expire.c b/src/expire.c index b23117a3c..598b27f96 100644 --- a/src/expire.c +++ b/src/expire.c @@ -64,7 +64,7 @@ int activeExpireCycleTryExpire(redisDb *db, dictEntry *de, long long now) { dbSyncDelete(db,keyobj); notifyKeyspaceEvent(NOTIFY_EXPIRED, "expired",keyobj,db->id); - if (server.tracking_clients) trackingInvalidateKey(keyobj); + trackingInvalidateKey(keyobj); decrRefCount(keyobj); server.stat_expiredkeys++; return 1; |