What is the right way to deal with caching when a user is switching a role. Here is the problem I'm trying to resolve:
My block caches different information based on capabilities. If a user switches the role and the cache is reset at that time, the course information is calculated based on the the switched role. If the user switches back to the normal role the cache needs to be reset and recalculated for the course. The block is used on course and site level and the same cache is used for both.
Those are the things I had in mind:
- Event fired if role is switched to invalidate cache but I could not find any event related to this would need to ask HQ to implement this.
- Skip cache if role is switched this would be more difficult to implement because the caching was all written with "get_many" and I would need to split individual checks per course to see if any of them have "is_role_switched.