示例#1
0
 /// <summary>
 /// 检查或设置客户端缓存(后台启用缓存并设时间>0)
 /// </summary>
 /// <returns></returns>
 public bool CheckAndSetClientCache()
 {
     if (Settings.Opti_ClientCache && Settings.Opti_ClientCacheSeconds > 0)
     {
         if (CacheUtil.CheckClientCacheExpires(Settings.Opti_ClientCacheSeconds))
         {
             CacheUtil.SetClientCache(this.Response, Settings.Opti_ClientCacheSeconds);
         }
         else
         {
             return(false);
         }
     }
     return(true);
 }
示例#2
0
 /// <summary>
 /// 检查或设置客户端缓存(自定义时间,单位:秒)
 /// </summary>
 /// <returns></returns>
 public bool CheckAndSetClientCache(int maxAge)
 {
     if (maxAge > 0)
     {
         if (CacheUtil.CheckClientCacheExpires(maxAge))
         {
             CacheUtil.SetClientCache(this.Response, maxAge);
         }
         else
         {
             return(false);
         }
     }
     return(true);
 }
示例#3
0
文件: WebCtx.cs 项目: lyfb/cms-1
        //        public bool CheckSiteState()
        //        {
        //            if (this.CurrentSite.State == SiteState.Normal)
        //            {
        //                return true;
        //            }
        //            else if (this.CurrentSite.State == SiteState.Closed)
        //            {
        //                this.RenderNotfound();
        //            }
        //            else if (this.CurrentSite.State == SiteState.Paused)
        //            {
        //                this.Render("<h1 style=\"color:red;text-align:center;font-size:16px;padding:20px\">网站维护中,暂停访问!</h1>");
        //                //this.RenderNotfound("<h1 style=\"color:red\">网站维护中,暂停访问!</h1>");
        //            }
        //            return false;
        //        }

        /// <summary>
        /// 检查或设置客户端缓存(后台启用缓存并设时间>0)
        /// </summary>
        /// <returns></returns>
        public bool CheckAndSetClientCache()
        {
            if (WebConf.Opti_ClientCache && WebConf.Opti_ClientCacheSeconds > 0)
            {
                if (CacheUtil.CheckClientCacheExpires(WebConf.Opti_ClientCacheSeconds))
                {
                    CacheUtil.SetClientCache(this._context.Response, WebConf.Opti_ClientCacheSeconds);
                }
                else
                {
                    return(false);
                }
            }
            return(true);
        }
示例#4
0
 public bool CheckClientCacheExpiresByEtag()
 {
     return(CacheUtil.CheckClientCacheExpires(cacheSha1ETag));
 }
示例#5
0
 public bool CheckClientCacheExpires(int seconds)
 {
     return(CacheUtil.CheckClientCacheExpires(seconds));
 }