Esempio n. 1
0
 public data.baseDS.lastPriceDataDataTable GetLastPrice(commonClass.PriceDataType type)
 {
     string cacheName = "lastPrice-" + type.ToString();
     data.baseDS.lastPriceDataDataTable dataTbl = null;
     object obj = sysDataCache.Find(cacheName);
     if (obj == null)
     {
         dataTbl = DbAccess.GetLastPrice(type);
         sysDataCache.Add(cacheName, new DataCacheItem(dataTbl));
         return dataTbl;
     }
     if ((obj as DataCacheItem).timeStamp + TimeSpan.FromSeconds(commonClass.Settings.sysDataDelayTimeInSecs).Ticks > DateTime.Now.Ticks)
     {
         return (data.baseDS.lastPriceDataDataTable)(obj as DataCacheItem).data;
     }
     dataTbl = DbAccess.GetLastPrice(type);
     sysDataCache.Add(cacheName, new DataCacheItem(dataTbl));
     return dataTbl;
 }