Add ScanCache to Environment. Provide thread safety to ScanCache.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>