ASP.NET 4.0의 OutputCacheProvider를 확인하고이를 사용하여 출력 캐시를 MongoDb 데이터베이스에 저장합니다. OutputCacheProvider의 재정의 메서드 중 하나 인 Add 메서드의 목적을 이해할 수 없습니다. VaryByParam을 무언가로 설정하면 Add 메서드가 호출됩니다. 따라서 VaryByParam = "id"이면 Add 메서드가 호출됩니다..NET 4.0 OutputCacheProvider 구현
그러나 Add the Set도 호출 된 후 Set 메서드 내에서 MongoDb 데이터베이스에 삽입 할 수 있습니다. 내가 QueryString을의 PARAMS를 얻기 위해 PathAndQuery를 사용하고 키에 MD5을하고 MongoDB를 데이터베이스에 저장 설정 방법 내부
public override void Set(string key, object entry, DateTime utcExpiry)
{
// if there is something in the query use the path and query to generate the key
var url = HttpContext.Current.Request.Url;
if (!String.IsNullOrEmpty(url.Query))
{
key = url.PathAndQuery;
}
Debug.WriteLine("Set(" + key + "," + entry + "," + utcExpiry + ")");
_service.Set(
new CacheItem() { Key = MD5(key), Item = entry, Expires = utcExpiry }
);
}
.
VaryByParam = "custom"또는 뭔가를하고있는 경우 Add 메서드가 유용 할 것 같습니다.
누구나 OutputCacheProvider의 Add 메서드에 대해 설명 할 수 있습니까?