MCPcopy
hub / github.com/silenceper/wechat / Set

Method Set

cache/memcache.go:44–52  ·  view source on GitHub ↗

Set cached value with key and expire time.

(key string, val interface{}, timeout time.Duration)

Source from the content-addressed store, hash-verified

42
43// Set cached value with key and expire time.
44func (mem *Memcache) Set(key string, val interface{}, timeout time.Duration) (err error) {
45 var data []byte
46 if data, err = json.Marshal(val); err != nil {
47 return err
48 }
49
50 item := &memcache.Item{Key: key, Value: data, Expiration: int32(timeout / time.Second)}
51 return mem.conn.Set(item)
52}
53
54// Delete delete value in memcache.
55func (mem *Memcache) Delete(key string) error {

Callers 1

TestMemcacheFunction · 0.95

Calls 1

SetMethod · 0.65

Tested by 1

TestMemcacheFunction · 0.76