示例#1
0
func (t *CacherSuite) TestSet(ch *C) {
	opts := cacher.Options{}
	opts.Engine = cacher.LOCALCACHE

	cacher.InitCache(opts)

	cacher.Set("a", []byte("b"))
}
示例#2
0
func (t *CacherSuite) TestGet(ch *C) {
	opts := cacher.Options{}
	opts.Engine = cacher.LOCALCACHE

	cacher.InitCache(opts)

	cacher.Set("c", []byte("d"))

	a := cacher.Get("c")

	ch.Assert(string(a), Equals, "d")
}
示例#3
0
func (t *CacherSuite) TestDelete(ch *C) {
	opts := cacher.Options{}
	opts.Engine = cacher.LOCALCACHE

	cacher.InitCache(opts)

	cacher.Set("e", []byte("f"))

	cacher.Delete("e")

	a := cacher.Get("e")

	ch.Assert(len(a), Equals, 0)
}
示例#4
0
func (t *CacherSuite) TestInit(ch *C) {
	opts := cacher.Options{}
	opts.Engine = cacher.LOCALCACHE

	cacher.InitCache(opts)
}