• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang cache.Cacher函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/macaron-contrib/cache.Cacher函数的典型用法代码示例。如果您正苦于以下问题:Golang Cacher函数的具体用法?Golang Cacher怎么用?Golang Cacher使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Cacher函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: newInstance

func newInstance() *macaron.Macaron {
	m := macaron.New()
	m.Use(macaron.Logger())
	m.Use(macaron.Recovery())
	m.Use(macaron.Static("static"))
	m.Use(pongo2.Pongoer(pongo2.Options{
		Directory:  "views",
		IndentJSON: macaron.Env != macaron.PROD,
		IndentXML:  macaron.Env != macaron.PROD,
	}))
	m.Use(cache.Cacher())
	m.Use(session.Sessioner())

	//DoXXX 表示GET请求;
	//OnXXX 表示POST请求;
	//AnyXXX 表示GET、POST混合请求
	m.Any("/", AnyValidate)

	m.Get("/dogs", DoDogs)
	m.Get("/pups", DoPups)
	m.Get("/about", DoAbout)
	m.Get("/comment", DoComment)
	m.Get("/signin", DoSignin)
	m.Get("/dogDetail", DoDogDetail)
	m.Get("/pupDetail", DoPupDetail)

	m.Post("/onComment", OnComment)
	m.Post("/onSignin", OnSignin)
	return m
}
开发者ID:zileyuan,项目名称:hidog,代码行数:30,代码来源:main.go


示例2: newMacaron

// newMacaron initializes Macaron instance.
func newMacaron() *macaron.Macaron {
	m := macaron.New()
	m.Use(macaron.Logger())
	m.Use(macaron.Recovery())
	if setting.EnableGzip {
		m.Use(macaron.Gziper())
	}
	m.Use(macaron.Static(
		path.Join(setting.StaticRootPath, "public"),
		macaron.StaticOptions{
			SkipLogging: !setting.DisableRouterLog,
		},
	))
	m.Use(macaron.Renderer(macaron.RenderOptions{
		Directory:  path.Join(setting.StaticRootPath, "templates"),
		Funcs:      []template.FuncMap{base.TemplateFuncs},
		IndentJSON: macaron.Env != macaron.PROD,
	}))
	m.Use(i18n.I18n(i18n.Options{
		SubURL:          setting.AppSubUrl,
		Directory:       path.Join(setting.ConfRootPath, "locale"),
		CustomDirectory: path.Join(setting.CustomPath, "conf/locale"),
		Langs:           setting.Langs,
		Names:           setting.Names,
		Redirect:        true,
	}))
	m.Use(cache.Cacher(cache.Options{
		Adapter:  setting.CacheAdapter,
		Interval: setting.CacheInternal,
		Conn:     setting.CacheConn,
	}))
	m.Use(captcha.Captchaer(captcha.Options{
		SubURL: setting.AppSubUrl,
	}))
	m.Use(session.Sessioner(session.Options{
		Provider: setting.SessionProvider,
		Config:   *setting.SessionConfig,
	}))
	m.Use(csrf.Generate(csrf.Options{
		Secret:     setting.SecretKey,
		SetCookie:  true,
		Header:     "X-Csrf-Token",
		CookiePath: setting.AppSubUrl,
	}))
	m.Use(toolbox.Toolboxer(m, toolbox.Options{
		HealthCheckFuncs: []*toolbox.HealthCheckFuncDesc{
			&toolbox.HealthCheckFuncDesc{
				Desc: "Database connection",
				Func: models.Ping,
			},
		},
	}))
	m.Use(middleware.Contexter())
	return m
}
开发者ID:ericcapricorn,项目名称:gogs,代码行数:56,代码来源:web.go


示例3: Test_Captcha

func Test_Captcha(t *testing.T) {
	Convey("Captch service", t, func() {
		m := macaron.New()
		m.Use(cache.Cacher())
		m.Use(Captchaer())
		m.Get("/", func() {

		})

		resp := httptest.NewRecorder()
		req, err := http.NewRequest("GET", "/", nil)
		So(err, ShouldBeNil)
		m.ServeHTTP(resp, req)
	})
}
开发者ID:macaron-contrib,项目名称:captcha,代码行数:15,代码来源:captcha_test.go


示例4: newMacaron

// newMacaron initializes Macaron instance.
func newMacaron() *macaron.Macaron {
	m := macaron.New()
	if !setting.DisableRouterLog {
		m.Use(macaron.Logger())
	}
	m.Use(macaron.Recovery())
	if setting.EnableGzip {
		m.Use(macaron.Gziper())
	}
	if setting.Protocol == setting.FCGI {
		m.SetURLPrefix(setting.AppSubUrl)
	}
	m.Use(macaron.Static(
		path.Join(setting.StaticRootPath, "public"),
		macaron.StaticOptions{
			SkipLogging: setting.DisableRouterLog,
		},
	))
	m.Use(macaron.Static(
		setting.AvatarUploadPath,
		macaron.StaticOptions{
			Prefix:      "avatars",
			SkipLogging: setting.DisableRouterLog,
		},
	))
	m.Use(macaron.Renderer(macaron.RenderOptions{
		Directory:  path.Join(setting.StaticRootPath, "templates"),
		Funcs:      []template.FuncMap{base.TemplateFuncs},
		IndentJSON: macaron.Env != macaron.PROD,
	}))

	localeNames, err := bindata.AssetDir("conf/locale")
	if err != nil {
		log.Fatal(4, "Fail to list locale files: %v", err)
	}
	localFiles := make(map[string][]byte)
	for _, name := range localeNames {
		localFiles[name] = bindata.MustAsset("conf/locale/" + name)
	}
	m.Use(i18n.I18n(i18n.Options{
		SubURL:          setting.AppSubUrl,
		Files:           localFiles,
		CustomDirectory: path.Join(setting.CustomPath, "conf/locale"),
		Langs:           setting.Langs,
		Names:           setting.Names,
		Redirect:        true,
	}))
	m.Use(cache.Cacher(cache.Options{
		Adapter:       setting.CacheAdapter,
		AdapterConfig: setting.CacheConn,
		Interval:      setting.CacheInternal,
	}))
	m.Use(captcha.Captchaer(captcha.Options{
		SubURL: setting.AppSubUrl,
	}))
	m.Use(session.Sessioner(setting.SessionConfig))
	m.Use(csrf.Csrfer(csrf.Options{
		Secret:     setting.SecretKey,
		SetCookie:  true,
		Header:     "X-Csrf-Token",
		CookiePath: setting.AppSubUrl,
	}))
	m.Use(toolbox.Toolboxer(m, toolbox.Options{
		HealthCheckFuncs: []*toolbox.HealthCheckFuncDesc{
			&toolbox.HealthCheckFuncDesc{
				Desc: "Database connection",
				Func: models.Ping,
			},
		},
	}))

	// OAuth 2.
	if setting.OauthService != nil {
		for _, info := range setting.OauthService.OauthInfos {
			m.Use(oauth2.NewOAuth2Provider(info.Options, info.AuthUrl, info.TokenUrl))
		}
	}
	m.Use(middleware.Contexter())
	return m
}
开发者ID:peterhadlaw,项目名称:gogs,代码行数:81,代码来源:web.go


示例5: Test_LedisCacher

func Test_LedisCacher(t *testing.T) {
	Convey("Test ledis cache adapter", t, func() {
		opt := cache.Options{
			Adapter:       "ledis",
			AdapterConfig: "data_dir=./tmp.db",
			Interval:      1,
		}

		Convey("Basic operations", func() {
			m := macaron.New()
			m.Use(cache.Cacher(opt))

			m.Get("/", func(c cache.Cache) {
				So(c.Put("uname", "unknwon", 1), ShouldBeNil)
				So(c.Put("uname2", "unknwon2", 1), ShouldBeNil)
				So(c.IsExist("uname"), ShouldBeTrue)

				So(c.Get("404"), ShouldBeNil)
				So(c.Get("uname").(string), ShouldEqual, "unknwon")

				time.Sleep(2 * time.Second)
				So(c.Get("uname"), ShouldBeNil)
				time.Sleep(1 * time.Second)
				So(c.Get("uname2"), ShouldBeNil)

				So(c.Put("uname", "unknwon", 0), ShouldBeNil)
				So(c.Delete("uname"), ShouldBeNil)
				So(c.Get("uname"), ShouldBeNil)

				So(c.Put("uname", "unknwon", 0), ShouldBeNil)
				So(c.Flush(), ShouldBeNil)
				So(c.Get("uname"), ShouldBeNil)
			})

			resp := httptest.NewRecorder()
			req, err := http.NewRequest("GET", "/", nil)
			So(err, ShouldBeNil)
			m.ServeHTTP(resp, req)

			m.Get("/id", func(c cache.Cache) {
				So(c.Incr("404"), ShouldNotBeNil)
				So(c.Decr("404"), ShouldNotBeNil)

				So(c.Put("int", 0, 0), ShouldBeNil)
				So(c.Put("int64", int64(0), 0), ShouldBeNil)
				So(c.Put("string", "hi", 0), ShouldBeNil)

				So(c.Incr("int"), ShouldBeNil)
				So(c.Incr("int64"), ShouldBeNil)

				So(c.Decr("int"), ShouldBeNil)
				So(c.Decr("int64"), ShouldBeNil)

				So(c.Incr("string"), ShouldNotBeNil)
				So(c.Decr("string"), ShouldNotBeNil)

				So(com.StrTo(c.Get("int").(string)).MustInt(), ShouldEqual, 0)
				So(com.StrTo(c.Get("int64").(string)).MustInt64(), ShouldEqual, 0)

				So(c.Flush(), ShouldBeNil)
			})

			resp = httptest.NewRecorder()
			req, err = http.NewRequest("GET", "/id", nil)
			So(err, ShouldBeNil)
			m.ServeHTTP(resp, req)
		})
	})
}
开发者ID:kolonse,项目名称:cache,代码行数:69,代码来源:ledis_test.go


示例6: Test_MysqlCacher

func Test_MysqlCacher(t *testing.T) {
	Convey("Test mysql cache adapter", t, func() {
		opt := cache.Options{
			Adapter:       "mysql",
			AdapterConfig: "root:@tcp(localhost:3306)/macaron?charset=utf8",
		}

		Convey("Basic operations", func() {
			m := macaron.New()
			m.Use(cache.Cacher(opt))

			m.Get("/", func(c cache.Cache) {
				So(c.Put("uname", "unknwon", 1), ShouldBeNil)
				So(c.Put("uname2", "unknwon2", 1), ShouldBeNil)
				So(c.IsExist("uname"), ShouldBeTrue)

				So(c.Get("404"), ShouldBeNil)
				So(c.Get("uname").(string), ShouldEqual, "unknwon")

				time.Sleep(1 * time.Second)
				So(c.Get("uname"), ShouldBeNil)
				time.Sleep(1 * time.Second)
				So(c.Get("uname2"), ShouldBeNil)

				So(c.Put("uname", "unknwon", 0), ShouldBeNil)
				So(c.Delete("uname"), ShouldBeNil)
				So(c.Get("uname"), ShouldBeNil)

				So(c.Put("uname", "unknwon", 0), ShouldBeNil)
				So(c.Flush(), ShouldBeNil)
				So(c.Get("uname"), ShouldBeNil)

				So(c.Put("struct", opt, 0), ShouldBeNil)
			})

			resp := httptest.NewRecorder()
			req, err := http.NewRequest("GET", "/", nil)
			So(err, ShouldBeNil)
			m.ServeHTTP(resp, req)
		})

		Convey("Increase and decrease operations", func() {
			m := macaron.New()
			m.Use(cache.Cacher(opt))

			m.Get("/", func(c cache.Cache) {
				// Escape GC at the momment.
				time.Sleep(1 * time.Second)

				So(c.Incr("404"), ShouldNotBeNil)
				So(c.Decr("404"), ShouldNotBeNil)

				So(c.Put("int", 0, 0), ShouldBeNil)
				So(c.Put("int32", int32(0), 0), ShouldBeNil)
				So(c.Put("int64", int64(0), 0), ShouldBeNil)
				So(c.Put("uint", uint(0), 0), ShouldBeNil)
				So(c.Put("uint32", uint32(0), 0), ShouldBeNil)
				So(c.Put("uint64", uint64(0), 0), ShouldBeNil)
				So(c.Put("string", "hi", 0), ShouldBeNil)

				So(c.Decr("uint"), ShouldNotBeNil)
				So(c.Decr("uint32"), ShouldNotBeNil)
				So(c.Decr("uint64"), ShouldNotBeNil)

				So(c.Incr("int"), ShouldBeNil)
				So(c.Incr("int32"), ShouldBeNil)
				So(c.Incr("int64"), ShouldBeNil)
				So(c.Incr("uint"), ShouldBeNil)
				So(c.Incr("uint32"), ShouldBeNil)
				So(c.Incr("uint64"), ShouldBeNil)

				So(c.Decr("int"), ShouldBeNil)
				So(c.Decr("int32"), ShouldBeNil)
				So(c.Decr("int64"), ShouldBeNil)
				So(c.Decr("uint"), ShouldBeNil)
				So(c.Decr("uint32"), ShouldBeNil)
				So(c.Decr("uint64"), ShouldBeNil)

				So(c.Incr("string"), ShouldNotBeNil)
				So(c.Decr("string"), ShouldNotBeNil)

				So(c.Get("int"), ShouldEqual, 0)
				So(c.Get("int32"), ShouldEqual, 0)
				So(c.Get("int64"), ShouldEqual, 0)
				So(c.Get("uint"), ShouldEqual, 0)
				So(c.Get("uint32"), ShouldEqual, 0)
				So(c.Get("uint64"), ShouldEqual, 0)

				So(c.Flush(), ShouldBeNil)
			})

			resp := httptest.NewRecorder()
			req, err := http.NewRequest("GET", "/", nil)
			So(err, ShouldBeNil)
			m.ServeHTTP(resp, req)
		})
	})
}
开发者ID:kolonse,项目名称:cache,代码行数:98,代码来源:mysql_test.go


示例7: main

func main() {
	// initiate the app
	m := macaron.Classic()

	// register middleware
	m.Use(macaron.Recovery())
	m.Use(macaron.Gziper())
	m.Use(macaron.Static("public",
		macaron.StaticOptions{
			// Prefix is the optional prefix used to serve the static directory content. Default is empty string.
			Prefix: "public",
			// SkipLogging will disable [Static] log messages when a static file is served. Default is false.
			SkipLogging: true,
			// IndexFile defines which file to serve as index if it exists. Default is "index.html".
			IndexFile: "index.html",
			// Expires defines which user-defined function to use for producing a HTTP Expires Header. Default is nil.
			// https://developers.google.com/speed/docs/insights/LeverageBrowserCaching
			Expires: func() string { return "max-age=0" },
		}))
	m.Use(session.Sessioner(session.Options{
		// Name of provider. Default is "memory".
		Provider: "memory",
		// Provider configuration, it's corresponding to provider.
		ProviderConfig: "",
		// Cookie name to save session ID. Default is "MacaronSession".
		CookieName: "MacaronSession",
		// Cookie path to store. Default is "/".
		CookiePath: "/",
		// GC interval time in seconds. Default is 3600.
		Gclifetime: 3600,
		// Max life time in seconds. Default is whatever GC interval time is.
		Maxlifetime: 3600,
		// Use HTTPS only. Default is false.
		Secure: false,
		// Cookie life time. Default is 0.
		CookieLifeTime: 0,
		// Cookie domain name. Default is empty.
		Domain: "",
		// Session ID length. Default is 16.
		IDLength: 16,
		// Configuration section name. Default is "session".
		Section: "session",
	}))
	m.Use(macaron.Renderer(macaron.RenderOptions{
		// Directory to load templates. Default is "templates".
		Directory: "templates",
		// Extensions to parse template files from. Defaults are [".tmpl", ".html"].
		Extensions: []string{".tmpl", ".html"},
		// Funcs is a slice of FuncMaps to apply to the template upon compilation. Default is [].
		Funcs: []template.FuncMap{map[string]interface{}{
			"AppName": func() string {
				return "Macaron"
			},
			"AppVer": func() string {
				return "1.0.0"
			},
		}},
		// Delims sets the action delimiters to the specified strings. Defaults are ["{{", "}}"].
		Delims: macaron.Delims{"{{", "}}"},
		// Appends the given charset to the Content-Type header. Default is "UTF-8".
		Charset: "UTF-8",
		// Outputs human readable JSON. Default is false.
		IndentJSON: true,
		// Outputs human readable XML. Default is false.
		IndentXML: true,
		// Prefixes the JSON output with the given bytes. Default is no prefix.
		// PrefixJSON: []byte("macaron"),
		// Prefixes the XML output with the given bytes. Default is no prefix.
		// PrefixXML: []byte("macaron"),
		// Allows changing of output to XHTML instead of HTML. Default is "text/html".
		HTMLContentType: "text/html",
	}))
	m.Use(cache.Cacher(cache.Options{
		// Name of adapter. Default is "memory".
		Adapter: "memory",
		// Adapter configuration, it's corresponding to adapter.
		AdapterConfig: "",
		// GC interval time in seconds. Default is 60.
		Interval: 60,
		// Configuration section name. Default is "cache".
		Section: "cache",
	}))

	// setup handlers
	m.Get("/", myHandler)
	m.Get("/welcome", myOtherHandler)
	m.Get("/query", myQueryStringHandler) // /query?name=Some+Name
	m.Get("/json", myJsonHandler)
	m.Post("/contact/submit", binding.Bind(ContactForm{}), mySubmitHandler)
	m.Get("/session", mySessionHandler)
	m.Get("/set/cookie/:value", mySetCookieHandler)
	m.Get("/get/cookie", myGetCookieHandler)
	m.Get("/database", myDatabaseHandler)
	m.Get("/database/list", myDatabaseListHandler)
	m.Get("/cache/write/:key/:value", myCacheWriteHandler)
	m.Get("/cache/read/:key", myCacheReadHandler)

	log.Println("Server is running on localhost:4000...")
	log.Println(http.ListenAndServe("0.0.0.0:4000", m))
}
开发者ID:james2doyle,项目名称:macaron-example,代码行数:100,代码来源:main.go


示例8: Test_MemcacheCacher

func Test_MemcacheCacher(t *testing.T) {
	Convey("Test memcache cache adapter", t, func() {
		opt := cache.Options{
			Adapter:       "memcache",
			AdapterConfig: "127.0.0.1:9090",
		}

		Convey("Basic operations", func() {
			m := macaron.New()
			m.Use(cache.Cacher(opt))

			m.Get("/", func(c cache.Cache) {
				So(c.Put("uname", "unknwon", 1), ShouldBeNil)
				So(c.Put("uname2", "unknwon2", 1), ShouldBeNil)
				So(c.IsExist("uname"), ShouldBeTrue)

				So(c.Get("404"), ShouldBeNil)
				So(c.Get("uname").(string), ShouldEqual, "unknwon")

				time.Sleep(1 * time.Second)
				So(c.Get("uname"), ShouldBeNil)
				time.Sleep(1 * time.Second)
				So(c.Get("uname2"), ShouldBeNil)

				So(c.Put("uname", "unknwon", 0), ShouldBeNil)
				So(c.Delete("uname"), ShouldBeNil)
				So(c.Get("uname"), ShouldBeNil)

				So(c.Put("uname", "unknwon", 0), ShouldBeNil)
				So(c.Flush(), ShouldBeNil)
				So(c.Get("uname"), ShouldBeNil)
			})

			resp := httptest.NewRecorder()
			req, err := http.NewRequest("GET", "/", nil)
			So(err, ShouldBeNil)
			m.ServeHTTP(resp, req)
		})

		Convey("Increase and decrease operations", func() {
			m := macaron.New()
			m.Use(cache.Cacher(opt))

			m.Get("/", func(c cache.Cache) {
				So(c.Incr("404"), ShouldNotBeNil)
				So(c.Decr("404"), ShouldNotBeNil)

				So(c.Put("int", 0, 0), ShouldBeNil)
				So(c.Put("int64", int64(0), 0), ShouldBeNil)
				So(c.Put("string", "hi", 0), ShouldBeNil)

				So(c.Incr("int"), ShouldBeNil)
				So(c.Incr("int64"), ShouldBeNil)

				So(c.Decr("int"), ShouldBeNil)
				So(c.Decr("int64"), ShouldBeNil)

				So(c.Incr("string"), ShouldNotBeNil)
				So(c.Decr("string"), ShouldNotBeNil)

				So(com.StrTo(c.Get("int").(string)).MustInt(), ShouldEqual, 0)
				So(com.StrTo(c.Get("int64").(string)).MustInt64(), ShouldEqual, 0)

				So(c.Flush(), ShouldBeNil)
			})

			resp := httptest.NewRecorder()
			req, err := http.NewRequest("GET", "/", nil)
			So(err, ShouldBeNil)
			m.ServeHTTP(resp, req)
		})
	})
}
开发者ID:kolonse,项目名称:cache,代码行数:73,代码来源:memcache_test.go


示例9: Test_PostgresCacher

func Test_PostgresCacher(t *testing.T) {
	Convey("Test postgres cache adapter", t, func() {
		opt := cache.Options{
			Adapter:       "postgres",
			AdapterConfig: "user=jiahuachen dbname=macaron port=5432 sslmode=disable",
		}

		Convey("Basic operations", func() {
			m := macaron.New()
			m.Use(cache.Cacher(opt))

			m.Get("/", func(c cache.Cache) {
				So(c.Put("uname", "unknwon", 1), ShouldBeNil)
				So(c.Put("uname2", "unknwon2", 1), ShouldBeNil)
				So(c.IsExist("uname"), ShouldBeTrue)

				So(c.Get("404"), ShouldBeNil)
				So(c.Get("uname").(string), ShouldEqual, "unknwon")

				time.Sleep(1 * time.Second)
				So(c.Get("uname"), ShouldBeNil)
				time.Sleep(1 * time.Second)
				So(c.Get("uname2"), ShouldBeNil)

				So(c.Put("uname", "unknwon", 0), ShouldBeNil)
				So(c.Delete("uname"), ShouldBeNil)
				So(c.Get("uname"), ShouldBeNil)

				So(c.Put("uname", "unknwon", 0), ShouldBeNil)
				So(c.Flush(), ShouldBeNil)
				So(c.Get("uname"), ShouldBeNil)

				So(c.Put("struct", opt, 0), ShouldBeNil)
			})

			resp := httptest.NewRecorder()
			req, err := http.NewRequest("GET", "/", nil)
			So(err, ShouldBeNil)
			m.ServeHTTP(resp, req)
		})

		Convey("Increase and decrease operations", func() {
			m := macaron.New()
			m.Use(cache.Cacher(opt))

			m.Get("/", func(c cache.Cache) {
				// Escape GC at the momment.
				time.Sleep(1 * time.Second)

				So(c.Incr("404"), ShouldNotBeNil)
				So(c.Decr("404"), ShouldNotBeNil)

				So(c.Put("int", 0, 0), ShouldBeNil)
				So(c.Put("int32", int32(0), 0), ShouldBeNil)
				So(c.Put("int64", int64(0), 0), ShouldBeNil)
				So(c.Put("uint", uint(0), 0), ShouldBeNil)
				So(c.Put("uint32", uint32(0), 0), ShouldBeNil)
				So(c.Put("uint64", uint64(0), 0), ShouldBeNil)
				So(c.Put("string", "hi", 0), ShouldBeNil)

				So(c.Decr("uint"), ShouldNotBeNil)
				So(c.Decr("uint32"), ShouldNotBeNil)
				So(c.Decr("uint64"), ShouldNotBeNil)

				So(c.Incr("int"), ShouldBeNil)
				So(c.Incr("int32"), ShouldBeNil)
				So(c.Incr("int64"), ShouldBeNil)
				So(c.Incr("uint"), ShouldBeNil)
				So(c.Incr("uint32"), ShouldBeNil)
				So(c.Incr("uint64"), ShouldBeNil)

				So(c.Decr("int"), ShouldBeNil)
				So(c.Decr("int32"), ShouldBeNil)
				So(c.Decr("int64"), ShouldBeNil)
				So(c.Decr("uint"), ShouldBeNil)
				So(c.Decr("uint32"), ShouldBeNil)
				So(c.Decr("uint64"), ShouldBeNil)

				So(c.Incr("string"), ShouldNotBeNil)
				So(c.Decr("string"), ShouldNotBeNil)

				So(c.Get("int"), ShouldEqual, 0)
				So(c.Get("int32"), ShouldEqual, 0)
				So(c.Get("int64"), ShouldEqual, 0)
				So(c.Get("uint"), ShouldEqual, 0)
				So(c.Get("uint32"), ShouldEqual, 0)
				So(c.Get("uint64"), ShouldEqual, 0)

				So(c.Flush(), ShouldBeNil)
			})

			resp := httptest.NewRecorder()
			req, err := http.NewRequest("GET", "/", nil)
			So(err, ShouldBeNil)
			m.ServeHTTP(resp, req)
		})
	})
}
开发者ID:kolonse,项目名称:cache,代码行数:98,代码来源:postgres_test.go



注:本文中的github.com/macaron-contrib/cache.Cacher函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang captcha.Captchaer函数代码示例发布时间:2022-05-23
下一篇:
Golang binding.Errors类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap