Cache results of `shouldBeIgnored`.

The include/exclude patterns were not intended to be "live" (meaning no changes are expected after construction). This change speeds up rebuilds pretty significantly when using the include/exclude filters since we do not need to retest the same string multiple times.