summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
Diffstat (limited to 'script/core')
-rw-r--r--script/core/noder.lua12
-rw-r--r--script/core/searcher.lua2
2 files changed, 1 insertions, 13 deletions
diff --git a/script/core/noder.lua b/script/core/noder.lua
index 2ef34e80..89be1e62 100644
--- a/script/core/noder.lua
+++ b/script/core/noder.lua
@@ -3,8 +3,6 @@ local guide = require 'parser.guide'
local collector = require 'core.collector'
local files = require 'files'
-local LastIDCache = {}
-local FirstIDCache = {}
local SPLIT_CHAR = '\x1F'
local LAST_REGEX = SPLIT_CHAR .. '[^' .. SPLIT_CHAR .. ']*$'
local FIRST_REGEX = '^[^' .. SPLIT_CHAR .. ']*'
@@ -972,15 +970,10 @@ end
---@param id string
---@return string
function m.getFirstID(id)
- if FirstIDCache[id] then
- return FirstIDCache[id] or nil
- end
local firstID, count = id:match(FIRST_REGEX)
if count == 0 then
- FirstIDCache[id] = false
return nil
end
- FirstIDCache[id] = firstID
return firstID
end
@@ -988,15 +981,10 @@ end
---@param id string
---@return string
function m.getLastID(id)
- if LastIDCache[id] then
- return LastIDCache[id] or nil
- end
local lastID, count = id:gsub(LAST_REGEX, '')
if count == 0 then
- LastIDCache[id] = false
return nil
end
- LastIDCache[id] = lastID
return lastID
end
diff --git a/script/core/searcher.lua b/script/core/searcher.lua
index 75176961..ee8af71a 100644
--- a/script/core/searcher.lua
+++ b/script/core/searcher.lua
@@ -200,7 +200,7 @@ local function crossSearch(status, uri, expect, mode, sourceUri)
end
local function checkCache(status, uri, expect, mode)
- local cache = vm.getCache('search:' .. mode)
+ local cache = vm.getCache('search:' .. mode, true)
local fileCache = cache[uri]
if not fileCache then
fileCache = {}