Agribusiness.Web.Services.SiteService.LoadSite C# (CSharp) Method

LoadSite() public static method

Loads Site from Cache if available, other goes to DB
public static LoadSite ( string siteId, bool forceReload = false ) : Site
siteId string
forceReload bool Force reload of the site
return Site
        public static Site LoadSite(string siteId, bool forceReload = false)
        {
            var site = (Site)System.Web.HttpContext.Current.Cache[siteId];

            if (site == null || !string.IsNullOrEmpty(siteId) || forceReload)
            {
                site = RepositoryFactory.SiteRepository.Queryable.FirstOrDefault(a => a.Id == siteId);

                if (site != null)
                {
                    ReCacheSite(site);
                }
            }

            return site;
        }