https://github.com/matrix-org/matrix-js-sdk/blob/develop/src/client.ts#L7430 was recently changed to use a persistent cache for profile keys, as there is now the ability (via MSCXXXX) to sync profile changes from the homeserver. However there are a couple of catches:
- Not all keys from a profile are synced, but a filtered set.
- Not all homeserver implementations support federated profile change updates, so federated users will be stale.
getExtendedProfileProperty will also store the result of an explicit fetch from the homeserver in the cache, and will keep it there forever. Therefore over time the client will build up a set of forever cached properties if they rely on this function.
The solution is probably to either not cache the results, or cache with a TTL such that a profile can only be so many minutes behind. The cache exists to ensure that on restart the client doesn't hammer the homeserver with many requests, so there needs to be some thought put into when to expire the caches.
https://github.com/matrix-org/matrix-js-sdk/blob/develop/src/client.ts#L7430 was recently changed to use a persistent cache for profile keys, as there is now the ability (via MSCXXXX) to sync profile changes from the homeserver. However there are a couple of catches:
getExtendedProfilePropertywill also store the result of an explicit fetch from the homeserver in the cache, and will keep it there forever. Therefore over time the client will build up a set of forever cached properties if they rely on this function.The solution is probably to either not cache the results, or cache with a TTL such that a profile can only be so many minutes behind. The cache exists to ensure that on restart the client doesn't hammer the homeserver with many requests, so there needs to be some thought put into when to expire the caches.