Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="key"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public static string Set(string key, object value)
        {
            var now      = DateTime.Now;
            var filePath = string.Format(Config.CacheFolder, key);

            try
            {
                var data = value.ObjToJson();
                filePath = FileParser.WriteFile(filePath, data, "UTF-8");

                Logger.Info(
                    $"写入文件缓存,{key + ":" + filePath},{data.Length} spent {DateTime.Now.Subtract(now).TotalMilliseconds} ms");
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }

            return(filePath);
        }