fix timeout issue when directories are crowded

Sorry, my editor removed whitespace from the end of lines and I didn't notice until after I pushed. Feel free to ignore that.

This solves the problem I'm having of wp qore timing out while calculating the size of the plugins directory. The combination of caching the results and checking for elapsed time makes the operation perform much quicker.