diff options
| author | ruki <[email protected]> | 2017-05-17 08:26:16 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-05-17 08:26:16 +0800 |
| commit | 807c7db15fa3a5e640ecde32ede9e72c4d64391c (patch) | |
| tree | 1ff7f32ba10ab23be15aff70167267996625c9f8 /xmake/core/project/cache.lua | |
| parent | c354c862526c9a149060639057bca380128a147a (diff) | |
improve find_program cache
Diffstat (limited to 'xmake/core/project/cache.lua')
| -rw-r--r-- | xmake/core/project/cache.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/xmake/core/project/cache.lua b/xmake/core/project/cache.lua index 1b3b63c7f..d96f12e00 100644 --- a/xmake/core/project/cache.lua +++ b/xmake/core/project/cache.lua @@ -56,6 +56,13 @@ function cache._instance(scopename) -- init instance local instance = table.inherit(cache) + -- memory cache? + if scopename:startswith("memory.") then + instance._CACHEDATA = instance._CACHEDATA or {__version = xmake._VERSION_SHORT} + instances[scopename] = instance + return instance + end + -- check scopename if not scopename:find("local%.") and not scopename:find("global%.") then os.raise("invalid cache scope: %s", scopename) @@ -110,6 +117,11 @@ function cache:flush() -- flush the version self._CACHEDATA.__version = xmake._VERSION_SHORT + -- memory cache? ignore it directly + if not self._CACHEPATH then + return true + end + -- save to file return io.save(self._CACHEPATH, self._CACHEDATA) end |
