switch/generic: add node cache and hash infrastructure