}
else
{
response.Write(cacheItem.Content);
SetClientCaching(response, cacheItem.Expires);
}
}
}
private void SetClientCaching(HttpResponse response, DateTime expires)
{
response.Cache.SetETag(DateTime.Now.Ticks.ToString());
response.Cache.SetLastModified(DateTime.Now);
//public 以指定响应能由客户端和共享(代理)缓存进行缓存。
response.Cache.SetCacheability(HttpCacheability.Public);
//是允许文档在被视为陈旧之前存在的最长绝对时间。
response.Cache.SetMaxAge(TimeSpan.FromTicks(expires.Ticks));
response.Cache.SetSlidingExpiration(true);
}
private class CompressCacheItem
{
/// <summary>
/// 类型 js 或 css
/// </summary>
public string Type { get; set; } // js css
/// <summary>
/// 内容
/// </summary>
public string Content { set; get; }
/// <summary>
/// 过期时间








