Skip to content

Commit

Permalink
change: don't move the expired item to the lru queue head when lookup.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuizhuhaomeng authored Dec 22, 2023
1 parent e8da878 commit bf5d9d3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ngx_http_lua_shdict.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,6 @@ ngx_http_lua_shdict_lookup(ngx_shm_zone_t *shm_zone, ngx_uint_t hash,
rc = ngx_memn2cmp(kdata, sd->data, klen, (size_t) sd->key_len);

if (rc == 0) {
ngx_queue_remove(&sd->queue);
ngx_queue_insert_head(&ctx->sh->lru_queue, &sd->queue);

*sdp = sd;

dd("node expires: %lld", (long long) sd->expires);
Expand All @@ -219,6 +216,9 @@ ngx_http_lua_shdict_lookup(ngx_shm_zone_t *shm_zone, ngx_uint_t hash,
}
}

ngx_queue_remove(&sd->queue);
ngx_queue_insert_head(&ctx->sh->lru_queue, &sd->queue);

return NGX_OK;
}

Expand Down

0 comments on commit bf5d9d3

Please sign in to comment.