1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-04 12:52:27 +08:00

update golangci (#349)

* update golangci
This commit is contained in:
silenceper
2020-11-26 12:25:57 +08:00
committed by GitHub
parent 185baa5d12
commit c0da806e03
9 changed files with 38 additions and 34 deletions

2
cache/cache.go vendored
View File

@@ -2,7 +2,7 @@ package cache
import "time"
//Cache interface
// Cache interface
type Cache interface {
Get(key string) interface{}
Set(key string, val interface{}, timeout time.Duration) error

10
cache/memcache.go vendored
View File

@@ -7,18 +7,18 @@ import (
"github.com/bradfitz/gomemcache/memcache"
)
//Memcache struct contains *memcache.Client
// Memcache struct contains *memcache.Client
type Memcache struct {
conn *memcache.Client
}
//NewMemcache create new memcache
// NewMemcache create new memcache
func NewMemcache(server ...string) *Memcache {
mc := memcache.New(server...)
return &Memcache{mc}
}
//Get return cached value
// Get return cached value
func (mem *Memcache) Get(key string) interface{} {
var err error
var item *memcache.Item
@@ -40,7 +40,7 @@ func (mem *Memcache) IsExist(key string) bool {
return true
}
//Set cached value with key and expire time.
// Set cached value with key and expire time.
func (mem *Memcache) Set(key string, val interface{}, timeout time.Duration) (err error) {
var data []byte
if data, err = json.Marshal(val); err != nil {
@@ -51,7 +51,7 @@ func (mem *Memcache) Set(key string, val interface{}, timeout time.Duration) (er
return mem.conn.Set(item)
}
//Delete delete value in memcache.
// Delete delete value in memcache.
func (mem *Memcache) Delete(key string) error {
return mem.conn.Delete(key)
}