Limit tgitcache

Allow users to limit the size of files to hash. This might mitigate issue #497 and #2240.