Optimize migrate-email-fields-command (#7035)
Quick follow up to prepare for 0.30 release
This commit is contained in:
@ -34,6 +34,16 @@ export class CacheManager<T> {
|
||||
return value;
|
||||
}
|
||||
|
||||
async clearKey(
|
||||
cacheKey: CacheKey,
|
||||
onDelete?: (value: T) => Promise<void> | void,
|
||||
): Promise<void> {
|
||||
if (this.cache.has(cacheKey)) {
|
||||
await onDelete?.(this.cache.get(cacheKey)!);
|
||||
this.cache.delete(cacheKey);
|
||||
}
|
||||
}
|
||||
|
||||
async clear(onDelete?: (value: T) => Promise<void> | void): Promise<void> {
|
||||
for (const value of this.cache.values()) {
|
||||
await onDelete?.(value);
|
||||
|
||||
Reference in New Issue
Block a user