MCPcopy Create free account
hub / github.com/TalkingData/owl / set

Method set

controller/cache/cache.go:59–72  ·  view source on GitHub ↗
(k string, x interface{}, d time.Duration)

Source from the content-addressed store, hash-verified

57}
58
59func (c *cache) set(k string, x interface{}, d time.Duration) {
60 var e int64
61 if d == DefaultExpiration {
62 d = c.defaultExpiration
63 }
64
65 if d > 0 {
66 e = time.Now().Add(d).UnixNano()
67 }
68 c.items[k] = Item{
69 Object: x,
70 Expiration: e,
71 }
72}
73
74func (c *cache) get(k string) (interface{}, bool) {
75 item, found := c.items[k]

Callers 2

AddMethod · 0.95
ReplaceMethod · 0.95

Calls 1

AddMethod · 0.45

Tested by

no test coverage detected