17a171a4b239e6e761e8f73a9b49451d7c918811 braney Wed Jun 19 17:14:25 2019 -0700 changes in response to code review (thanks Jonathan!) diff --git src/hg/lib/hdb.c src/hg/lib/hdb.c index 711522c..8551634 100644 --- src/hg/lib/hdb.c +++ src/hg/lib/hdb.c @@ -4096,56 +4096,57 @@ struct trackDb *hTrackDb(char *db) /* Load tracks associated with current db. * Supertracks are loaded as a trackDb, but are not in the returned list, * but are accessible via the parent pointers of the member tracks. Also, * the supertrack trackDb subtrack fields are not set here (would be * incompatible with the returned list) * Returns list sorted by priority * NOTE: this result is cached, do not free it ! */ { if (trackHubDatabase(db)) return NULL; struct trackDb *tdbList = NULL; +char *trackDbCacheDir = cfgOption("cacheTrackDbDir"); boolean doCache = FALSE; -if (sameOk(cfgOption("cacheTrackDb"), "on")) +if (trackDbCacheDir != NULL) doCache = TRUE; if (doCache) { char *table = hTrackDbPath(); struct sqlConnection *conn = hAllocConn(db); time_t tableTime = sqlTableUpdateTime(conn, table); hFreeConn(&conn); - struct trackDb *cacheTdb = trackDbCache(db, tableTime); + struct trackDb *cacheTdb = trackDbCache(db, tableTime, trackDbCacheDir); if (cacheTdb != NULL) return cacheTdb; memCheckPoint(); // we want to know how much memory is used to build the tdbList } tdbList = loadTrackDb(db, NULL); tdbList = trackDbLinkUpGenerations(tdbList); tdbList = trackDbPolishAfterLinkup(tdbList, db); if (doCache) - trackDbCloneTdbListToSharedMem(db, tdbList, memCheckPoint()); + trackDbCloneTdbListToSharedMem(db, tdbList, memCheckPoint(), trackDbCacheDir); return tdbList; } static struct trackDb *loadAndLookupTrackDb(struct sqlConnection *conn, char *where) /* Load trackDb object(s). Nothing done for composite tracks here. */ { return loadTrackDb(sqlGetDatabase(conn), where); } static struct trackDb *loadTrackDbForTrack(struct sqlConnection *conn, char *track) /* Load trackDb object for a track. this is common code for two external * functions. Handle composite tracks and subtrack inheritance here.