public virtual Tuple <object, bool> Fill(FreshnessRequest freshness) { HttpCacheShim.Log("Fill", () => "(" + freshness + ") " + Name); var keyString = Name; var startTime = DateTime.UtcNow; var started = s_RunningQueries.TryAdd(keyString, startTime); try { if (started) { var backfilling = freshness == FreshnessRequest.AsyncBackfill; if (backfilling) { if (NumberOfRefillsRemaining > 0) { NumberOfRefillsRemaining--; } HttpCacheShim.Log("Refiller", () => "backfilling " + Name + " remaining " + NumberOfRefillsRemaining); } var result = Filler(freshness); return(Tuple.Create(result, false)); } else { HttpCacheShim.Log("Refiller", () => keyString + " already inflight"); return(Tuple.Create(default(object), true)); } } finally { if (started) { var endTime = DateTime.UtcNow; s_RunningQueries.TryRemove(keyString, out startTime); HttpCacheShim.Log("Refiller", () => keyString + " @" + startTime + " [" + (endTime - startTime) + "]"); } } }
public virtual void Put(object value) { HttpCacheShim.Log("Put", () => "[" + Name + "] " + value); Putter(this, value); }