public static void RefreshCreators() { XDocument doc = XDocument.Load(CreatorsUrl); CreatorInfoCollection creators = new CreatorInfoCollection(doc.Element("creators").Elements("creatorInfo")); ZCache.InsertCache(CreatorsCacheKey, creators, CacheTime); }
public static void RefreshCatalogs() { XDocument doc = XDocument.Load(CatalogsUrl); CatalogInfoCollection catalogs = new CatalogInfoCollection(doc.Element("catalogs").Elements("catalogInfo")); ZCache.InsertCache(CatalogsCacheKey, catalogs, CacheTime); }
public void RefreshCategories() { XDocument doc = XDocument.Load(CategoryUrl); CategoryInfoCollection categories = new CategoryInfoCollection(this, doc.Element("categories").Elements("categoryInfo")); ZCache.InsertCache(CategoryCacheKey, categories, Marketplace.CacheTime); }
protected object GetPostsByTag(string key, GraffitiContext graffitiContext) { PostCollection pc = ZCache.Get <PostCollection>("Tags-" + TagName); if (pc == null) { pc = Post.FetchPostsByTag(TagName); ZCache.InsertCache("Tags-" + TagName, pc, 60); } return(pc); }
public void RefreshCreators() { CreatorInfoCollection creators = new CreatorInfoCollection(); foreach (ItemInfo item in Items.Values) { if (!creators.ContainsKey(item.CreatorId)) { creators.Add(item.CreatorId, item.Creator); } } ZCache.InsertCache(CreatorCacheKey, creators, Marketplace.CacheTime); }
/// <summary> /// Process the request for the feed. /// </summary> /// <param name="context">The HTTP context for the request.</param> public virtual void ProcessRequest(HttpContext context) { Context = context; string feed = ZCache.Get <string>(this.CacheKey); if (feed == null) { feed = BuildFeed(); ZCache.InsertCache(this.CacheKey, feed, this.CacheTime); } WriteFeed(feed); }
public void SendPings(object state) { if (pingServiceUrls == null || pingServiceUrls.Length == 0) { return; } foreach (string pingUrl in pingServiceUrls) { if (!string.IsNullOrEmpty(pingUrl)) { this.Url = pingUrl.Trim(); bool result = false; string errorMessage = string.Empty; // Try to remember if the last ping to this URL supported the ExtendedPing spec, so we don't send out unnecessary pings repeatdly bool isExtendedPing = true; string lastPingResult = ZCache.Get <string>(CacheKey(pingUrl)); if (!string.IsNullOrEmpty(lastPingResult)) { try { isExtendedPing = bool.Parse(lastPingResult); } catch { } } if (isExtendedPing) { try { PingResult response = ExtendedPing(this.siteName, this.siteUrl, this.siteUrl, this.siteFeedUrl); if (response.flerror != null && response.flerror == true) { if (string.IsNullOrEmpty(response.message)) { errorMessage = "Remote weblogUpdates.extendedPing service indicated an error but provided no error message."; } else { errorMessage = response.message; } } else { result = true; } } catch (CookComputing.XmlRpc.XmlRpcException ex) { errorMessage = ex.Message; } catch (System.Exception ex) { errorMessage = ex.Message; } // If the ExtendedPing request failed, try a basic ping to this url if (!result) { isExtendedPing = false; } } if (!isExtendedPing) { try { PingResult response = BasicPing(this.siteName, this.siteUrl); if (response.flerror != null && response.flerror == true) { if (string.IsNullOrEmpty(response.message)) { errorMessage = "Remote weblogUpdates.ping service indicated an error but provided no error message."; } else { errorMessage = response.message; } } else { result = true; } } catch (CookComputing.XmlRpc.XmlRpcException ex) { errorMessage = ex.Message; } catch (System.Exception ex) { errorMessage = ex.Message; } } // Log succcess or failure to EventLog if (result) { // Remember whether extended or basic ping worked for this url in the future ZCache.InsertCache(CacheKey(pingUrl), isExtendedPing.ToString(), 43200); string message = String.Format("Blog Ping sent to {0}.", pingUrl); Log.Info("Ping Sent", message); } else { string message = String.Format("Blog Ping attempt to the url {0} failed. Error message returned was: {1}.", pingUrl, errorMessage); Log.Warn("Ping Error", message); } } } }