Reuse known fileids and cache data in the scanner

Saves having to do multiple `getId` calls for every file and folder being scanned.

Saves about ~~50%~~ ~~80%~~ 90%  of the database class made during a filescan

cc @PVince81 @DeepDiver1975 @th3fallen 
Added documentation