diff options
| author | ruki <[email protected]> | 2022-06-19 22:48:46 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-06-19 22:48:46 +0800 |
| commit | 01eeb3325c51d18f79b61303fb4d17af011b7dd0 (patch) | |
| tree | 5cfd2d47d5d5ae62a3b7ffa0a9898b1684fd4864 /xmake/modules/private/cache/build_cache.lua | |
| parent | eb965315b1030cc2de426909500d34f99d281943 (diff) | |
cache outdata/errdata for remote cache
Diffstat (limited to 'xmake/modules/private/cache/build_cache.lua')
| -rw-r--r-- | xmake/modules/private/cache/build_cache.lua | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/xmake/modules/private/cache/build_cache.lua b/xmake/modules/private/cache/build_cache.lua index 13bebcbdf..882f50f9a 100644 --- a/xmake/modules/private/cache/build_cache.lua +++ b/xmake/modules/private/cache/build_cache.lua @@ -150,12 +150,16 @@ function get(cachekey) if os.isfile(objectfile_cached) then _g.hit_count = (_g.hit_count or 0) + 1 return objectfile_cached, objectfile_infofile - elseif remote_cache_client.is_connected() and - remote_cache_client.singleton():pull(cachekey, objectfile_cached) and - os.isfile(objectfile_cached) then - _g.hit_count = (_g.hit_count or 0) + 1 - _g.remote_hit_count = (_g.remote_hit_count or 0) + 1 - return objectfile_cached, objectfile_infofile + elseif remote_cache_client.is_connected() then + local exists, extrainfo = remote_cache_client.singleton():pull(cachekey, objectfile_cached) + if exists and os.isfile(objectfile_cached) then + _g.hit_count = (_g.hit_count or 0) + 1 + _g.remote_hit_count = (_g.remote_hit_count or 0) + 1 + if extrainfo then + io.save(objectfile_infofile, extrainfo) + end + return objectfile_cached, objectfile_infofile + end end end @@ -179,7 +183,7 @@ function put(cachekey, objectfile, extrainfo) local cacheinfo = remote_cache_client.singleton():cacheinfo(cachekey) if not cacheinfo or not cacheinfo.exists then _g.remote_newfiles_count = (_g.remote_newfiles_count or 0) + 1 - remote_cache_client.singleton():push(cachekey, objectfile) + remote_cache_client.singleton():push(cachekey, objectfile, extrainfo) end end end |
