Пример #1
0
        public List <VmpConfigModel> ListConfig()
        {
            var cache = CacheManage.GetInstance();

            var result = cache.Get(CacheConfig.VmpConfigCacheKey, true, () =>
            {
                List <VmpConfigModel> list        = new List <VmpConfigModel>();
                Vmp_ConfigCollection daConfigColl = new Vmp_ConfigCollection();
                daConfigColl.ListAll();
                list = MapProvider.Map <VmpConfigModel>(daConfigColl.DataTable);
                return(list);
            });

            return(result);
        }
Пример #2
0
        /// <summary>
        /// 更新缓存交易深度记录
        /// </summary>
        /// <param name="configModel">数据配置</param>
        /// <param name="priceModel">价格深度</param>
        /// <returns></returns>
        public bool UpdateLatePrice(VmpConfigModel configModel, LatePriceModel priceModel)
        {
            Log.Info($"更新市场深度缓存UpdateLatePrice:{configModel.PlatformCode}_{configModel.PairCode}");
            string             cacheKey   = string.Format("LatePrice_{0}_{1}", configModel.PlatformId, configModel.PairId);
            LatePriceCacheBase priceCache = InsertPrice(configModel, priceModel);
            var cache = CacheManage.GetInstance();

            if (!cache.Add(cacheKey, priceCache))
            {
                Alert("更新缓存失败");
                Log.Error("更新缓存失败" + cacheKey);
                return(false);
            }
            return(true);
        }