As a Roblox developer, it is currently too hard or impossible to get up-to-date web resources after they have been cached on the server. It is possible to set up a workaround with HttpService or pulling information from clients, but this is tedious, and in the case of pulling data from the client, insecure.
Group ranks, in particular, are a major pain point for me. After the server requests the rank of a user in a group, it will never issue another request as long as the server is alive. This causes problems when games have special functionality for group members and you want to integrate groups closely with your game (e.g. factions). In addition to group information, there are lots of other web resources that are cached on the server as well, like
PlayerHasPass whenever that gets enabled again.
I propose that Roblox consolidate the cache system into a CacheService and expose this cache to the developer. Internally, the old
IsInGroup/etc functions would work the same, but they would set their cache under a specific scope and key.
If you called
GetRankInGroup, then the results of that call would be stored under CacheService internally. Then, if you wanted to to get up-to-date information, you could run
CacheService:ClearGroupCache(groupId, userId) before issuing the method call again.
This pattern could be extended with more methods added to CacheService for each cache type, e.g.,
ClearMarketplaceInfoCache, etc. I think that creating new methods for each type would be better than having a generalized
Clear(scope, key) method because for cached items like GetRankInGroup, the key would be some arbitrary combination of the group id and user id, and remembering magic strings (or in this case, patterns) like this doesn’t feel good as a developer (Looking at you,
I think that this solution is better than adding another parameter to the methods themselves to ignore cache or just disabling the cache outright, because in a lot of situations, the cache is actually favorable, both for the developer and Roblox. There are just some situations when it just gets in the way, so I think we should have a way to explicitly clear specific cached data. If Roblox feels that this will be too straining for the platform, I think this implementation could still work even if the frequency of the cache clears was limited even to once per minute per scope/key.
If Roblox is able to address your this issue, it would save me and a lot of other developers a lot of time by not having to develop long-winded workarounds just to get up-to-date data.