Beispiel #1
0
        /// <summary>
        /// 从缓存中获取文件最后更新时间
        /// </summary>
        /// <returns></returns>
        private static string GetFileUpdateTime(string key, string filePath)
        {
            object tmp;

            if (!WebCache.GetCacheTryParse(key, out tmp))
            {
                tmp = LoadFileUpdateTime(filePath);
                WebCache.Add(key, tmp);
            }
            return(tmp as string);
        }
Beispiel #2
0
        /// <summary>
        /// 将数据加载到缓存中
        /// </summary>
        /// <returns></returns>
        public List <StationInfo> GetStationInfoList()
        {
            //首页判断文件是否被改动过
            var newUpdateFileTime = LoadFileUpdateTime(NanChangStationFilePath);
            var oldUpdateFileTime = GetFileUpdateTime(cacheStationInfoUpdateTimeKey, NanChangStationFilePath);

            object tmp;

            if (!WebCache.GetCacheTryParse(cacheStationInfoListKey, out tmp) || newUpdateFileTime != oldUpdateFileTime)
            {
                tmp = LoadStationInfo();
                WebCache.Add(cacheStationInfoListKey, tmp);
            }
            return(tmp as List <StationInfo>);
        }
Beispiel #3
0
        /// <summary>
        /// 获取西站温馨提示
        /// </summary>
        /// <returns></returns>
        public string GetWestReminderTxt()
        {
            //首页判断文件是否被改动过
            var newUpdateFileTime = LoadFileUpdateTime(NanChangWestStationTipFilePath);
            var oldUpdateFileTime = GetFileUpdateTime(cacheWestReminderUpdateTimeKey, NanChangWestStationTipFilePath);

            object tmp;

            if (!WebCache.GetCacheTryParse(cacheWestReminderTxtKey, out tmp) || newUpdateFileTime != oldUpdateFileTime)
            {
                tmp = LoadReminderTxtFromFile(NanChangWestStationTipFilePath);
                WebCache.Add(cacheWestReminderTxtKey, tmp);
            }
            return(tmp.ToString());
        }