DNN Dynamic Roles Tip 1: Use “Caching Time” to improve performance

If you have set up dynamic roles with complex rules that are expensive to evaluate, or you do not expect that the rule’s result will change from one second to another, you can use the dynamic role’s “Caching Time” setting to increase performance. In detail, after the rule is evaluated (and depending on the result, so whether the user was¬†added to or removed from the dynamic role) the “Caching Time” defines the timespan in which the rule is not evaluated again.¬†During this time the user’s role membership status remains unchanged.

One scenario for a rule where setting a “Caching Time” is recommended is a dynamic rule with trigger “Request” that’s based on geo localisation (see section “Geo Location” in the docs). Since most likely the user’s location won’t change from one request to the next, it is reasonable to use a suitable “Caching Time” to evaluate the rule only once in a while.