There is 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-bbac9b5f-18be-47da-93ff-b85bcc8d97bf XWIKI-23050 In Progress

The group members cache can quickly end up being filled with users as key

 
View issue   ยท   Add comment
 

1 comment

 
cid:jira-generated-image-avatar-58fc651c-5cea-41d7-af7a-c0cf8945d493 Michael Hamann on 28/Mar/25 12:05
 

I'm not sure we should have a cache that indicates for every user if it might be a group. The problem with this kind of cache that it would still make the loading of the group slow: we still need to perform a database query for every user and the new cache needs to be big enough to fit every user to not repeat this every time the members of a group are queried after the group has been updated.

I suggest to instead maintain per wiki a set of all documents that are groups. The API could still be isGroup(DocumentReference), but instead of having a cache, the first time we get such a request for a document in a wiki, we perform a single database query on that wiki to list all groups of that wiki. Further, we have a listener on document create/update/delete to catch when a document becomes a group/is no longer a group.

That way, the storage just scales in the number of groups and not in the number of users, and on restart, we only need to perform a single database query per wiki to initialize the data structure, so we can get the members of a group that just contains users with a constant number of database queries.