1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-08 14:42:26 +08:00

1.增加redis支持 2.memcached支持多类型缓存

This commit is contained in:
wenzl
2017-10-26 10:46:25 +08:00
parent 013f4ed585
commit 00ab67f623
3 changed files with 153 additions and 11 deletions

32
cache/redis_test.go vendored Normal file
View File

@@ -0,0 +1,32 @@
package cache
import (
"testing"
"time"
)
func TestRedis(t *testing.T) {
opts := &RedisOpts{
Host: "127.0.0.1:6379",
}
redis := NewRedis(opts)
var err error
timeoutDuration := 1 * time.Second
if err = redis.Set("username", "silenceper", timeoutDuration); err != nil {
t.Error("set Error", err)
}
if !redis.IsExist("username") {
t.Error("IsExist Error")
}
name := redis.Get("username").(string)
if name != "silenceper" {
t.Error("get Error")
}
if err = redis.Delete("username"); err != nil {
t.Errorf("delete Error , err=%v", err)
}
}