function getMap(id){
            var route = getRoute(id);
            var cache = jsonCache[route];
            if(!cache){
                var filePath = path.join(root, route, 'map.json');
                try{
                    cache = jsonCache[route] = JSON.parse(fs.readFileSync(filePath));
                }catch(e){
                    throw e;
                }
            }
            return cache;
        }
function getMap(id){
            var route = getRoute(id);
            var cache = jsonCache[route];
            if(!cache){
                var filePath = path.join(root, route, 'map.json');
                try{
                    cache = jsonCache[route] = JSON.parse(fs.readFileSync(filePath));
                }catch(e){
                    throw e;
                }
            }
            return cache;
        }
function getMap ( id ) { var route = getRoute ( id ) ; var cache = jsonCache [ route ] ; if ( ! cache ) { var filePath = path . join ( root , route , 'map.json' ) ; try { cache = jsonCache [ route ] = JSON . parse ( fs . readFileSync ( filePath ) ) ; } catch ( e ) { throw e ; } } return cache ; }
获取id所在json文件的json数据(如果在缓存中找不到对应数据,则读取文件)
获取id所在json文件的json数据 ( 如果在缓存中找不到对应数据 则读取文件 )