Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
20 lines
631 B
Plaintext
20 lines
631 B
Plaintext
var cachePromise = new Map();
|
|
var getCachePromise = function (cacheKey) {
|
|
return cachePromise.get(cacheKey);
|
|
};
|
|
var setCachePromise = function (cacheKey, promise) {
|
|
// Should cache the same promise, cannot be promise.finally
|
|
// Because the promise.finally will change the reference of the promise
|
|
cachePromise.set(cacheKey, promise);
|
|
// no use promise.finally for compatibility
|
|
promise
|
|
.then(function (res) {
|
|
cachePromise.delete(cacheKey);
|
|
return res;
|
|
})
|
|
.catch(function () {
|
|
cachePromise.delete(cacheKey);
|
|
});
|
|
};
|
|
export { getCachePromise, setCachePromise };
|