AspNet.StarterKits.Classifieds.Web.CategoryCache.GetParentCategoriesById C# (CSharp) Method

GetParentCategoriesById() public static method

public static GetParentCategoriesById ( HttpContext context, int categoryId ) : List
context System.Web.HttpContext
categoryId int
return List
		public static List<CachedCategory> GetParentCategoriesById(HttpContext context, int categoryId)
		{
			string cacheKey = "PC" + categoryId.ToString();
			DateTime expiration = DateTime.Now.AddDays(1);
			List<CachedCategory> parentCategories = context.Cache[cacheKey] as List<CachedCategory>;
			if (parentCategories == null)
			{
				parentCategories = FetchParentCategoriesById(categoryId);
				CacheDependency watchAllCategoriesKey = new System.Web.Caching.CacheDependency(null, AllCategoriesKeyArrayWrap);
				context.Cache.Add(cacheKey, parentCategories, watchAllCategoriesKey, expiration, TimeSpan.Zero, System.Web.Caching.CacheItemPriority.Normal, null);
			}
			return parentCategories;
		}

Same methods

CategoryCache::GetParentCategoriesById ( int categoryId ) : List