0
현재 웹 사이트를 구축하고 있으며 LinqToSQL을 사용하여 SqlCacheDependency를 구현했습니다.SQL 프로필러에서 여전히 조회가 발생해야합니까?
public IQueryable<VictoryList> GetVictoryList()
{
string cacheKey = HttpContext.Current.User.Identity.Name + "victoryCacheKey";
IQueryable<VictoryList> cachednews = (IQueryable<VictoryList>)HttpContext.Current.Cache.Get(cacheKey);
if (cachednews == null)
{
var results = from v in _datacontext.ViewVictoryLists
orderby _datacontext.GetNewId()
select new VictoryList
{
MemberID = v.MemberID,
Username = v.Aspnetusername,
Location = v.Location,
DaimokuGoal = v.DaimokuGoal,
PreviewImageID = v.PreviewImageID,
TotalDaimoku = v.TotalDaimoku,
TotalDeterminations = v.TotalDeterminations,
DeterminationID = v.DeterminationID,
DeterminationName = v.DeterminationName
};
SqlCacheDependency dependency =
new SqlCacheDependency(_datacontext.GetCommand(results) as SqlCommand);
HttpContext.Current.Cache.Add(cacheKey, results, dependency, DateTime.MaxValue,
TimeSpan.Zero, CacheItemPriority.Normal, null);
return results.ToList().AsQueryable();
}
return cachednews;
}
은 내가 아직도 내가 SqlCacheDependency의 CommandBroker 모드를 사용하고, 쿼리를 통해 실행 참조 SQLProfiler에서 사물을 보는 그러나 동안 상황이 noticbly 빠른 특히 일부 복잡한 쿼리에있는로 일 것으로 보인다. 데이터가 캐시 된 개체에서 가져 오는 경우에도 여전히 쿼리를 볼 수 있습니까?
감사합니다. – dswatik