diff --git a/lib/datasource/cargo/index.js b/lib/datasource/cargo/index.js index 741b259208435ed655c8c58476fdfb9ce58ab4cc..20ad10cb88bd0635585e51a6781d52a9da4271c1 100644 --- a/lib/datasource/cargo/index.js +++ b/lib/datasource/cargo/index.js @@ -8,6 +8,15 @@ async function getPkgReleases({ lookupName }) { if (!lookupName) { return null; } + + const cacheNamespace = 'cargo'; + const cacheKey = lookupName; + const cachedResult = await renovateCache.get(cacheNamespace, cacheKey); + // istanbul ignore if + if (cachedResult) { + return cachedResult; + } + const len = lookupName.length; let path; // Ignored because there is no way to test this without hitting up GitHub API @@ -74,6 +83,9 @@ async function getPkgReleases({ lookupName }) { } return release; }); + + const cacheMinutes = 10; + await renovateCache.set(cacheNamespace, cacheKey, result, cacheMinutes); return result; } catch (err) { if (err.statusCode === 404 || err.code === 'ENOTFOUND') {