@@ -17,6 +17,14 @@ export class MetadataValueCache {
|
||||
return `${type}::${holderId ?? ''}::${key}`;
|
||||
}
|
||||
|
||||
static getCachedValue<T>(
|
||||
type: MetadataHolderType,
|
||||
holderId: string | number | undefined,
|
||||
key: string,
|
||||
): T | undefined {
|
||||
return this.convertedValueByKey.get(this.getCacheKey(type, holderId, key)) as T | undefined;
|
||||
}
|
||||
|
||||
static getStableValue<T>(
|
||||
type: MetadataHolderType,
|
||||
holderId: string | number | undefined,
|
||||
@@ -26,7 +34,7 @@ export class MetadataValueCache {
|
||||
): T {
|
||||
const cacheKey = this.getCacheKey(type, holderId, key);
|
||||
const cachedRawValue = this.rawValueByKey.get(cacheKey);
|
||||
const cachedConvertedValue = this.convertedValueByKey.get(cacheKey);
|
||||
const cachedConvertedValue = this.getCachedValue<T>(type, holderId, key);
|
||||
|
||||
if (cachedRawValue !== undefined && rawValue === cachedRawValue) {
|
||||
return cachedConvertedValue as T;
|
||||
|
||||
Reference in New Issue
Block a user