What if the caching of permission system and user group system is very complicated?

for example, in a user group, a user can belong to multiple groups, and multiple users in a group need to do bidirectional caching because they need to obtain groupSet:getByUserId:xxx userSet:getByGroupId:xxx in both directions

then role, permission roleSet:getByUserId:xxx

when you create a new group, you have to initialize a lot of things, such as permissions, team members, etc., into the cache, which leads to a lot of distributed transactions (database rollback, cache does not roll), and distributed transactions have consistency problems, and then it becomes very complex

what should I do with this?

Menu