42e4fcaeceaed8da9e9ddcad54e120677194a9e4 braney Wed Jun 12 15:18:57 2019 -0700 add caching expiration on trackDb cache diff --git src/hg/lib/hdb.c src/hg/lib/hdb.c index 3d14ae6..4b07585 100644 --- src/hg/lib/hdb.c +++ src/hg/lib/hdb.c @@ -4100,31 +4100,37 @@ * 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 ! */ { struct trackDb *tdbList = NULL; boolean doCache = FALSE; if (sameOk(cfgOption("cacheTrackDb"), "on")) doCache = TRUE; if (doCache) { - struct trackDb *cacheTdb = trackDbCache(db); + char *table = hTrackDbPath(); + + struct sqlConnection *conn = hAllocConn(db); + time_t tableTime = sqlTableUpdateTime(conn, table); + hFreeConn(&conn); + + struct trackDb *cacheTdb = trackDbCache(db, tableTime); 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()); return tdbList;