Fix saving long metadata values

fixes #900
This commit is contained in:
schroda
2026-01-27 23:19:37 +01:00
parent 64df9a9489
commit 63ebfd120e
9 changed files with 390 additions and 73 deletions

View File

@@ -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;