Exemplo n.º 1
0
        public Car findCarByCarId(string id)
        {
            Car    cars = null;
            string key  = "Select_CarById" + id;

            if (enableCaching)
            {
                cars = HttpRuntime.Cache[key] as Car;
            }
            if (cars == null)
            {
                cars = manager.findCarByCarId(id);
            }
            if (cars != null)
            {
                //// If the data is not in the cache then fetch the data from the business logic tier
                AggregateCacheDependency cd = DependencyFacade.GetSelCarByIdDependency();
                // Store the output in the data cache, and Add the necessary AggregateCacheDependency object
                HttpRuntime.Cache.Add(key, cars, cd, DateTime.Now.AddHours(UserRegTimeout), Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            }
            return(cars);
        }