public bool TryGetComponent(string componentUri, out IComponent component, string templateUri = "") { LoggerService.Debug(">>TryGetComponent ({0})", LoggingCategory.Performance, componentUri); component = null; string cacheKey = String.Format(CacheKeyFormatByUri, componentUri, templateUri); component = (IComponent)CacheAgent.Load(cacheKey); if (component != null) { LoggerService.Debug("<<TryGetComponent ({0}) - from cache", LoggingCategory.Performance, componentUri); return(true); } string content = !String.IsNullOrEmpty(templateUri) ? ComponentProvider.GetContent(componentUri, templateUri) : ComponentProvider.GetContent(componentUri); if (string.IsNullOrEmpty(content)) { LoggerService.Debug("<<TryGetComponent ({0}) - from provider", LoggingCategory.Performance, componentUri); return(false); } LoggerService.Debug("about to create IComponent from content ({0})", LoggingCategory.Performance, componentUri); component = GetIComponentObject(content); LoggerService.Debug("finished creating IComponent from content ({0})", LoggingCategory.Performance, componentUri); if (IncludeLastPublishedDate) { ((Component)component).LastPublishedDate = ComponentProvider.GetLastPublishedDate(componentUri); } LoggerService.Debug("about to store IComponent in cache ({0})", LoggingCategory.Performance, componentUri); CacheAgent.Store(cacheKey, CacheRegion, component); LoggerService.Debug("finished storing IComponent in cache ({0})", LoggingCategory.Performance, componentUri); LoggerService.Debug("<<TryGetComponent ({0})", LoggingCategory.Performance, componentUri); return(true); }
public DateTime GetLastPublishedDate(string uri) { return(ComponentProvider.GetLastPublishedDate(uri)); }