serverspec/specinfra — pull request #48 by elmundio87 (2014-02-03 15:16:49+00:00)
Title: Cache results of ListWindowsFeatures for 2 minutes

This pull request reduces the amount of calls to dism.exe when running specs that describes more than 1 windows feature. It can take upwards of 10 seconds to return the list, and only 1 instance of dism.exe can be run at a time. dism.exe blocks other instances of dism.exe while it's running, which could cause problems if running serverspec tasks in parallel.

The feature list is now generated using dism.exe then cached for 2 minutes. During those 2 minutes, subsequent invocations of the ListWindowsFeatures function will return the cached feature list, which will return a result within 1 second.

This should help alleviate the blocking problem. In addition, caching reduced the time it took for me to test 50 windows features from 12 minutes down to 2 minutes.