Add reverse dependency analysis
When conditions change, or are invalidated, it would be nice to be able to selectively invalidate particular cached results. Conditions themselves are fairly straightforward, but the difficulty is
DeclarativePolicy::Runner objects, which cache a write-once
@state to represent their result.
If you know which ability on which needs invalidating, then it is easy enough to do so by setting the
nil on the
Policy#runner(ability) (we do need to support cache invalidation however).
But if all you know is the condition, then identifying runners which need invalidation is impossible.
Either add reverse-dependency analysis (i.e., given a condition, tell me what abilities on which policies could be affected). Given the dynamic nature of class loading, this is probably hard-to-impossible.
A more realistic alternative is probably to record the conditions that were evaluated during the processing of a runner, and use this to find any existing cached runners that need invalidation.