Model dependencies change event

Hi!

Is there a way to receive events when dependencies is added or removed?
I've found an event like this only for modules, but couldn't find anything similar for models.

In my language I have a very commonly used concept that references a class.
Scope for such a node is created from `model.nodesIncludingImported(ClassConcept).where(isValidReference)`.
The problem is that scope is effectively similar for all the nodes in a model, but it gets recreated for each separate node,
and `isValidReference` is a time-consuming operation, so overall performance is affected greatly.

I want to implement a "model scope" that will cache the scope for all the nodes in a model to use,
and recalculate it only when model imports are changed.

Thanks is advance!

Please sign in to leave a comment.