which: add time-sensitive caching to which calls
* this is mostly for Komodo startup, where it walks over the path
   many times, searching for executables

(integrated from trunk branch change d05dd85 by Todd Whiteman <toddw@activestate.com>)