use cache to reduce concurrent fs.realpath calls

this also has the side effect of removing duplicate aliases from files