Beispiel #1
0
        /// <summary>
        /// 设置控件的cache
        /// </summary>
        /// <param name="path"></param>
        /// <param name="parameter"></param>
        /// <param name="html"></param>
        private void SetCache(string path, string parameter, string html)
        {
            if (html == null)
            {
                return;
            }
            string key = path + (parameter != string.Empty ? "?" + parameter : null);

            key = "Cache_Control_" + key.ToLower();

            var config = CacheControlConfiguration.GetConfig();

            //判断config配置信息
            if (config != null && config.Enabled)
            {
                for (int index = 0; index < config.Rules.Count; index++)
                {
                    var rule = config.Rules[index];
                    if (rule.Path.ToLower().Contains(path.ToLower()))
                    {
                        CacheHelper.Insert(key, html, null, rule.Timeout);
                        break;
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 获取控件的cache
        /// </summary>
        /// <param name="path"></param>
        /// <param name="parameter"></param>
        /// <returns></returns>
        private string GetCache(string path, string parameter)
        {
            string key = path + (parameter != string.Empty ? "?" + parameter : null);

            key = "Cache_Control_" + key.ToLower();

            var config = CacheControlConfiguration.GetConfig();

            //判断config配置信息
            if (config != null && config.Enabled)
            {
                return(CacheHelper.Get <string>(key));
            }

            return(null);
        }