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

Method Replace

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

Source from the content-addressed store, hash-verified

98}
99
100func (c *cache) Replace(k string, x interface{}, d time.Duration) error {
101 c.mu.Lock()
102 //check exit
103 _, found := c.get(k)
104 if !found {
105 c.mu.Unlock()
106 err := fmt.Errorf("Item:%s dosen't exit", k)
107 return err
108 }
109 c.set(k, x, d)
110 c.mu.Unlock()
111 return nil
112}
113
114func (c *cache) Increment(k string, n int64) error {
115 c.mu.Lock()

Callers 1

WriteMethod · 0.80

Calls 2

getMethod · 0.95
setMethod · 0.95

Tested by

no test coverage detected