@@ -1234,6 +1234,7 @@ function m.status(parentStatus, interface, deep)
1234
1234
local status = {
1235
1235
share = parentStatus and parentStatus .share or {
1236
1236
count = 0 ,
1237
+ cacheLock = {},
1237
1238
},
1238
1239
depth = parentStatus and (parentStatus .depth + 1 ) or 0 ,
1239
1240
searchDeep = parentStatus and parentStatus .searchDeep or deep or - 999 ,
@@ -2882,6 +2883,7 @@ end
2882
2883
-- end
2883
2884
2884
2885
function m .getRefCache (status , obj , mode )
2886
+ local isDeep = status .deep
2885
2887
local globalCache = status .interface .cache and status .interface .cache () or {}
2886
2888
if m .isGlobal (obj ) then
2887
2889
obj = m .getKeyName (obj )
@@ -2893,29 +2895,36 @@ function m.getRefCache(status, obj, mode)
2893
2895
if sourceCache then
2894
2896
return sourceCache
2895
2897
end
2896
- sourceCache = {}
2897
- globalCache [mode ][obj ] = sourceCache
2898
+ if not status .share .cacheLock [mode ] then
2899
+ status .share .cacheLock [mode ] = {}
2900
+ end
2901
+ if status .share .cacheLock [mode ][obj ] then
2902
+ return {}
2903
+ end
2904
+ status .share .cacheLock [mode ][obj ] = {}
2898
2905
return nil , function ()
2899
2906
if status .hasGenericResult then
2900
- globalCache [mode ][obj ] = nil
2907
+ status . share . cacheLock [mode ][obj ] = nil
2901
2908
return
2902
2909
end
2910
+ sourceCache = {}
2903
2911
local results = status .results
2904
2912
for i = 1 , # results do
2905
2913
sourceCache [i ] = results [i ]
2906
2914
end
2907
- -- if mode == 'ref'
2908
- -- or mode == 'def' then
2909
- -- for i = 1, #results do
2910
- -- local res = results[i]
2911
- -- if not globalCache[mode][res] then
2912
- -- cache[mode][res] = sourceCache
2913
- -- if isDeep then
2914
- -- globalCache[mode][res] = sourceCache
2915
- -- end
2916
- -- end
2917
- -- end
2918
- -- end
2915
+ globalCache [mode ][obj ] = sourceCache
2916
+ if not isDeep then
2917
+ return
2918
+ end
2919
+ if mode == ' ref'
2920
+ or mode == ' def' then
2921
+ for i = 1 , # results do
2922
+ local res = results [i ]
2923
+ if not globalCache [mode ][res ] then
2924
+ globalCache [mode ][res ] = sourceCache
2925
+ end
2926
+ end
2927
+ end
2919
2928
end
2920
2929
end
2921
2930
0 commit comments