示例#1
0
    /// <summary>
    /// 尝试获取缓存的输出
    /// </summary>
    /// <returns>缓存的输出</returns>
    protected virtual ICachedResponse ResolveCache( string virtualPath )
    {
      var policy = HtmlServices.GetCachePolicy( HttpContext );

      if ( policy == null )
        return null;


      CachePolicy = policy;

      var clientCachePolicy = policy as IClientCacheablePolicy;

      if ( clientCachePolicy != null )
      {

        var response = clientCachePolicy.ResolveClientCache();
        if ( response != null )
          return response;

      }

      return CachePolicy.ResolveCache();
    }
示例#2
0
    /// <summary>
    /// 更新缓存数据
    /// </summary>
    /// <param name="cachedResponse">可被缓存的响应数据</param>
    /// <param name="context">MVC 请求上下文</param>
    /// <param name="policy">缓存策略</param>
    protected virtual void UpdateCache( ICachedResponse cachedResponse, ControllerContext context, CachePolicy policy )
    {

      policy.UpdateCache( cachedResponse );
    }