openresty / luajit2

OpenResty's Branch of LuaJIT 2
https://luajit.org/luajit.html
Other
1.2k stars 193 forks source link

Shared dictionary cannot retrieve stale data #217

Closed fairyqb closed 3 months ago

fairyqb commented 5 months ago

Please see the following file example: shm_stale_resty_test.lua.txt

If this line in the code is commented out, stale data cannot be retrieved from the shared dictionary.

line 12: dict:set("init_dict", "init", 0)

zhuizhuhaomeng commented 5 months ago

@fairyqb

If this line in the code is commented out, stale data cannot be retrieved from the shared dictionary.

This is because the expired entry was reclaimed. You add init_dict with 0 expired time which means it will not expire. This entry at the LRU end prevents reclaiming expired entries.

fairyqb commented 5 months ago

@fairyqb

This is because the expired entry was reclaimed. You add init_dict with 0 expired time which means it will not expire. This entry at the LRU end prevents reclaiming expired entries.

This is a different key.

zhuizhuhaomeng commented 3 months ago

@fairyqb why did you reopen this issue?

zhuizhuhaomeng commented 3 months ago

You should move this issue to lua-nginx-module repository.