MCPcopy Create free account
hub / github.com/baidu/EasyFaaS / set

Method set

pkg/util/cache/cache.go:88–100  ·  view source on GitHub ↗
(k string, x interface{}, d time.Duration)

Source from the content-addressed store, hash-verified

86}
87
88func (c *cache) set(k string, x interface{}, d time.Duration) {
89 var e int64
90 if d == DefaultExpiration {
91 d = c.defaultExpiration
92 }
93 if d > 0 {
94 e = time.Now().Add(d).UnixNano()
95 }
96 c.items[k] = Item{
97 Object: x,
98 Expiration: e,
99 }
100}
101
102// Add an item to the cache, replacing any existing item, using the default
103// expiration.

Callers 4

AddMethod · 0.95
ReplaceMethod · 0.95

Calls 1

AddMethod · 0.45

Tested by 2