[#9896] Reduces time to process TVs

Creates a cache for results of directory scan.
Modifies modTemplateVar::getRenderDirectories() for use of this cache.

Signed-off-by: Anton Andersen <anton.a.andersen@gmail.com>