fix(cache): call JSON.stringify when storing value in cache.tryGet (#20671)
* fix(cache): call JSON.stringify when storing value in cache.tryGet
The value is returned as-is, so we may assume that it's not JSON
stringified inside `getValueFunc`. Otherwise, the caller already needs
to distinguish between values that are either JSON parsed or not.
* Revert "fix(routes/mastodon): don't refresh account ID cache (#20663)"
This reverts commit c2cff410fa.
* test: add test
* test: lint
This commit is contained in:
Vendored
+1
-1
@@ -141,7 +141,7 @@ export default {
|
||||
return v as T;
|
||||
} else {
|
||||
const value = await getValueFunc();
|
||||
cacheModule.set(key, value, maxAge);
|
||||
cacheModule.set(key, JSON.stringify(value), maxAge);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user