From 4f5dcfa9e413ebaa3709098bee5c1fbc91cda231 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 3 Dec 2025 22:26:07 +0800 Subject: mark target/package/toolchain:memcache as public --- xmake/core/tool/toolchain.lua | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'xmake/core/tool') diff --git a/xmake/core/tool/toolchain.lua b/xmake/core/tool/toolchain.lua index 2230aae9e..1da1634db 100644 --- a/xmake/core/tool/toolchain.lua +++ b/xmake/core/tool/toolchain.lua @@ -98,6 +98,16 @@ function _instance:fullname() return namespace and namespace .. "::" .. name or name end +-- get memcache +function _instance:memcache() + local cache = self._MEMCACHE + if not cache then + cache = memcache.cache("core.tool.toolchain." .. self:cachekey()) + self._MEMCACHE = cache + end + return cache +end + -- get toolchain platform function _instance:plat() return self._PLAT or self:config("plat") @@ -482,8 +492,7 @@ end function _instance:_checktool(toolkind, toolpath) -- get result from cache first - local cachekey = self:cachekey() .. "_checktool" .. toolkind - local result = toolchain._memcache():get3(cachekey, toolkind, toolpath) + local result = self:memcache():get2("checktool_" .. toolkind, toolpath) if result then return result[1], result[2] end @@ -526,6 +535,7 @@ function _instance:_checktool(toolkind, toolpath) end -- find tool program + local cachekey = self:cachekey() .. "_checktool" .. toolkind local tool = find_tool(toolpath, {toolchain = self, cachekey = cachekey, program = program or toolpath, @@ -552,7 +562,7 @@ function _instance:_checktool(toolkind, toolpath) utils.cprint("${dim}checking for %s (%s: ${bright}%s${clear}) ... ${color.nothing}${text.nothing}", description, toolkind, toolpath) end end - toolchain._memcache():set3(cachekey, toolkind, toolpath, {program, toolname}) + self:memcache():set2("checktool_" .. toolkind, toolpath, {program, toolname}) return program, toolname end -- cgit v1.3.1