// Look up a schema based on site, histology and an optional discriminator. // @param lookup schema lookup input // @return a list of StagingSchemaInfo objects public List <StagingSchema> lookupSchema(SchemaLookup lookup) { List <StagingSchema> lstRetval = null; // If doing a more broad lookup without giving both site and histology, do not use the cache. I don't want to cache // since the results could include all the data if (lookup.getSite() == null || lookup.getHistology() == null) { return(getSchemas(lookup)); } // Dictionary for cache. String sIDString = lookup.GetHashString(); if (!mLookupMemoryDict.TryGetValue(sIDString, out lstRetval)) { if (miLookupMemoryDictCount > NUM_ITEMS_IN_CACHE_CAUSES_TRIM) { mLookupMemoryDict.Clear(); Interlocked.Exchange(ref miLookupMemoryDictCount, 0); } lstRetval = getSchemas(lookup); if (mLookupMemoryDict.TryAdd(sIDString, lstRetval)) { Interlocked.Increment(ref miLookupMemoryDictCount); } } return(lstRetval); }