Optimize view paths caching for plugins.

Closes #2047