Client side caching: don't hash the key if not needed.
This commit is contained in:
parent
bcf3cf8832
commit
ab49072362
@ -156,12 +156,15 @@ void sendTrackingMessage(client *c, long long hash) {
|
|||||||
|
|
||||||
/* This function is called from signalModifiedKey() or other places in Redis
|
/* This function is called from signalModifiedKey() or other places in Redis
|
||||||
* when a key changes value. In the context of keys tracking, our task here is
|
* when a key changes value. In the context of keys tracking, our task here is
|
||||||
* to send a notification to every client that may have keys about such . */
|
* to send a notification to every client that may have keys about such caching
|
||||||
|
* slot. */
|
||||||
void trackingInvalidateKey(robj *keyobj) {
|
void trackingInvalidateKey(robj *keyobj) {
|
||||||
|
if (TrackingTable == NULL || TrackingTableUsedSlots == 0) return;
|
||||||
|
|
||||||
sds sdskey = keyobj->ptr;
|
sds sdskey = keyobj->ptr;
|
||||||
uint64_t hash = crc64(0,
|
uint64_t hash = crc64(0,
|
||||||
(unsigned char*)sdskey,sdslen(sdskey))&(TRACKING_TABLE_SIZE-1);
|
(unsigned char*)sdskey,sdslen(sdskey))&(TRACKING_TABLE_SIZE-1);
|
||||||
if (TrackingTable == NULL || TrackingTable[hash] == NULL) return;
|
if (TrackingTable[hash] == NULL) return;
|
||||||
|
|
||||||
raxIterator ri;
|
raxIterator ri;
|
||||||
raxStart(&ri,TrackingTable[hash]);
|
raxStart(&ri,TrackingTable[hash]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user