—— main.go



package main

import (

var markdownContents = []byte(`## Hello Markdown

This is a sample of Markdown contents


All features of Sundown are supported, including:

*   **Compatibility**. The Markdown v1.0.3 test suite passes with
    the --tidy option.  Without --tidy, the differences are
    mostly in whitespace and entity escaping, where blackfriday is
    more consistent and cleaner.

*   **Common extensions**, including table support, fenced code
    blocks, autolinks, strikethroughs, non-strict emphasis, etc.

*   **Safety**. Blackfriday is paranoid when parsing, making it safe
    to feed untrusted user input without fear of bad things
    happening. The test suite stress tests this and there are no
    known inputs that make it crash.  If you find one, please let me
    know and send me the input that does it.

    NOTE: "safety" in this context means *runtime safety only*. In order to
    protect yourself against JavaScript injection in untrusted content, see
    [this example](

*   **Fast processing**. It is fast enough to render on-demand in
    most web applications without having to cache the output.

*   **Routine safety**. You can run multiple parsers in different
    goroutines without ill effect. There is no dependence on global
    shared state.

*   **Minimal dependencies**. Blackfriday only depends on standard
    library packages in Go. The source code is pretty
    self-contained, so it is easy to add to any project, including
    Google App Engine projects.

*   **Standards compliant**. Output successfully validates using the
    W3C validation tool for HTML 4.01 and XHTML 1.0 Transitional.

    [this is a link]( `)

func main() {
    app := iris.New()
    app.Get("/", cache.Handler(10*time.Second), writeMarkdown)
    // 将其内容保存在第一个请求中并提供服务而不是重新加载内容。
    // 10秒后,它将被清除并重置。

func writeMarkdown(ctx iris.Context) {
    println("Handler executed. Content refreshed.")
/* 请注意,`StaticWeb`默认使用浏览器的磁盘缓存


  1. 第一次访问,服务器会返回所有信息,当在缓存时间之内请求服务器,将得到最缓存的信息。过期以后将从新在服务生成。
  2. 适合于静态页面做缓存

results matching ""

    No results matching ""