From 66981b3840308c0ccc7b783ecc8a382fcf112b51 Mon Sep 17 00:00:00 2001 From: Emil Zhai Date: Wed, 9 Sep 2015 15:23:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=8C=E4=B8=9A=E6=9F=93=E8=89=B2=EF=BC=9A?= =?UTF-8?q?=E4=BF=AE=E5=A4=8DL1=E6=9B=B4=E6=96=B0=E7=9A=84=E4=B8=80?= =?UTF-8?q?=E5=A4=84BUG=E3=80=81=E4=BC=98=E5=8C=96N2ID=E6=98=A0=E5=B0=84?= =?UTF-8?q?=E8=A1=A8=E6=96=87=E4=BB=B6=E8=AF=BB=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Farbnamen/src/MY_Farbnamen.lua | 37 ++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/Farbnamen/src/MY_Farbnamen.lua b/Farbnamen/src/MY_Farbnamen.lua index abac6ff07..7cb3666e7 100644 --- a/Farbnamen/src/MY_Farbnamen.lua +++ b/Farbnamen/src/MY_Farbnamen.lua @@ -101,32 +101,35 @@ local InfoCache = (function() bUpdated = true end -- save player info + -- update L1 CACHE + if bUpdated or not tCache[k] then + if #aCache > 3000 then + tremove(aCache, 1) + end + tinsert(aCache, v) + tCache[k] = v + tCache[v.n] = v + end + -- update DataBase if bUpdated then - -- update DataBase + -- save info to DataBase if not tInfos[nSegID] then tInfos[nSegID] = MY.LoadLUAData(SZ_DATA_PATH:format(nSegID)) or {} end tInfos[nSegID][k] = v tInfoVisit[nSegID] = GetTime() tInfoModified[nSegID] = GetTime() - -- update L1 CACHE - if #aCache > 3000 then - tremove(aCache, 1) + -- save szName to dwID indexing to DataBase + local nSegID = string.byte(v.n) + if not tName2ID[nSegID] then + tName2ID[nSegID] = MY.LoadLUAData(SZ_N2ID_PATH:format(nSegID)) or {} end - tinsert(aCache, v) - tCache[k] = v - tCache[v.n] = v - end - -- save szName to dwID indexing - local nSegID = string.byte(v.n) - if not tName2ID[nSegID] then - tName2ID[nSegID] = MY.LoadLUAData(SZ_N2ID_PATH:format(nSegID)) or {} - end - if tName2ID[nSegID][v.n] ~= k then - tName2ID[nSegID][v.n] = k - tName2IDModified[nSegID] = GetTime() + if tName2ID[nSegID][v.n] ~= k then + tName2ID[nSegID][v.n] = k + tName2IDModified[nSegID] = GetTime() + end + tName2IDVisit[nSegID] = GetTime() end - tName2IDVisit[nSegID] = GetTime() end end end,