@bedrock/kms 10.1.0 → 10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/lib/keystores.js +11 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/lib/keystores.js
CHANGED
|
@@ -16,6 +16,7 @@ import './config.js';
|
|
|
16
16
|
|
|
17
17
|
const USAGE_COUNTER_MAX_CONCURRENCY = 100;
|
|
18
18
|
let KEYSTORE_CONFIG_CACHE;
|
|
19
|
+
let DISABLE_CLEAR_CACHE_ON_UPDATE = false;
|
|
19
20
|
|
|
20
21
|
// cache only exported for testing purposes
|
|
21
22
|
export {KEYSTORE_CONFIG_CACHE as _KEYSTORE_CONFIG_CACHE};
|
|
@@ -198,8 +199,10 @@ export async function update({config, explain = false} = {}) {
|
|
|
198
199
|
});
|
|
199
200
|
}
|
|
200
201
|
|
|
201
|
-
|
|
202
|
-
|
|
202
|
+
if(!DISABLE_CLEAR_CACHE_ON_UPDATE) {
|
|
203
|
+
// delete record from cache
|
|
204
|
+
KEYSTORE_CONFIG_CACHE.delete(config.id);
|
|
205
|
+
}
|
|
203
206
|
|
|
204
207
|
return true;
|
|
205
208
|
}
|
|
@@ -210,7 +213,7 @@ export async function update({config, explain = false} = {}) {
|
|
|
210
213
|
* @param {object} options - The options to use.
|
|
211
214
|
* @param {string} options.id - The ID of the keystore.
|
|
212
215
|
* @param {boolean} [options.fresh=false] - False if it is safe to use a
|
|
213
|
-
* potentially cached value,
|
|
216
|
+
* potentially cached value, true to always get a fresh value.
|
|
214
217
|
*
|
|
215
218
|
* @returns {Promise<object>} Resolves to `{config, meta}`.
|
|
216
219
|
*/
|
|
@@ -335,3 +338,8 @@ export async function _getUncachedRecord({id, explain = false} = {}) {
|
|
|
335
338
|
}
|
|
336
339
|
return record;
|
|
337
340
|
}
|
|
341
|
+
|
|
342
|
+
// exported for testing purposes
|
|
343
|
+
export function _disableClearCacheOnUpdate(disable) {
|
|
344
|
+
DISABLE_CLEAR_CACHE_ON_UPDATE = disable;
|
|
345
|
+
}
|