Added cache invalidation functionality #7279
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Invalidate GetNodeRightsCache entries when a user's permissions on a device or mesh.
This is a proposal for #7274.
In short, changing permissions can invalidate cache values, causing some users to not get permissions they should, or causing a user to continue having permissions for 10 seconds after they are removed from a device/mesh.
This version uses a hierarchal cache in order to allow cache invalidations for various scopes (user, mesh, device). The upside is that it allows us to empty the cache selectively based on what permissions are modified. Downside is the cache lookup is a bit more complicated (time should be about the same since there's no strcat happening), and cache invalidation of the entire user needs to iterate over all its children in order to do a correct cache count manipulation. This could be avoided if we were just fine with cache count being wrong and flushing slightly more often, but I didn't want to make that executive decision.