protected override void Visit(CacheChunk chunk) { var siteGuid = Guid.NewGuid(); CodeIndent(chunk) .Write("if (BeginCachedContent(\"") .Write(siteGuid.ToString("n")) .Write("\", new global::Spark.CacheExpires(") .WriteCode(chunk.Expires) .Write("), ") .WriteCode(chunk.Key) .WriteLine("))") .WriteLine("{").AddIndent(); _source .WriteLine("try"); AppendOpenBrace(); Accept(chunk.Body); AppendCloseBrace(); _source .WriteLine("finally") .WriteLine("{").AddIndent() .Write("EndCachedContent(") .WriteCode(chunk.Signal) .Write(");") .RemoveIndent().WriteLine("}") .RemoveIndent().WriteLine("}"); }
private void VisitCache(SpecialNode specialNode, SpecialNodeInspector inspector) { var keyAttr = inspector.TakeAttribute("key"); var expiresAttr = inspector.TakeAttribute("expires"); var signalAttr = inspector.TakeAttribute("signal"); var chunk = new CacheChunk { Position = Locate(specialNode.Element) }; if (keyAttr != null) { chunk.Key = AsCode(keyAttr); } else { chunk.Key = "\"\""; } if (expiresAttr != null) { chunk.Expires = AsCode(expiresAttr); } else { chunk.Expires = ""; } if (signalAttr != null) { chunk.Signal = AsCode(signalAttr); } else { chunk.Signal = ""; } Chunks.Add(chunk); using (new Frame(this, chunk.Body)) Accept(inspector.Body); }
private void VisitCache(SpecialNode specialNode, SpecialNodeInspector inspector) { AttributeNode attr = inspector.TakeAttribute("key"); AttributeNode node2 = inspector.TakeAttribute("expires"); AttributeNode node3 = inspector.TakeAttribute("signal"); CacheChunk item = new CacheChunk { Position = this.Locate(specialNode.Element) }; if (attr != null) { item.Key = this.AsCode(attr); } else { item.Key = "\"\""; } if (node2 != null) { item.Expires = this.AsCode(node2); } else { item.Expires = ""; } if (node3 != null) { item.Signal = this.AsCode(node3); } else { item.Signal = ""; } this.Chunks.Add(item); using (new Frame(this, item.Body)) { base.Accept(inspector.Body); } }
protected abstract void Visit(CacheChunk chunk);
protected override void Visit(CacheChunk chunk) { Examine(chunk.Key); Examine(chunk.Expires); Accept(chunk.Body); }
private void VisitCache(SpecialNode specialNode, SpecialNodeInspector inspector) { var keyAttr = inspector.TakeAttribute("key"); var expiresAttr = inspector.TakeAttribute("expires"); var signalAttr = inspector.TakeAttribute("signal"); var chunk = new CacheChunk { Position = Locate(specialNode.Element) }; if (keyAttr != null) chunk.Key = AsCode(keyAttr); else chunk.Key = "\"\""; if (expiresAttr != null) chunk.Expires = AsCode(expiresAttr); else chunk.Expires = ""; if (signalAttr != null) chunk.Signal = AsCode(signalAttr); else chunk.Signal = ""; Chunks.Add(chunk); using (new Frame(this, chunk.Body)) Accept(inspector.Body); }
protected override void Visit(CacheChunk chunk) { Accept(chunk.Body); }
protected override void Visit(CacheChunk chunk) { this.Examine(chunk.Key); this.Examine(chunk.Expires); base.Accept(chunk.Body); }