Method
Replace
(k string, x interface{}, d time.Duration)
Source from the content-addressed store, hash-verified
| 98 | } |
| 99 | |
| 100 | func (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 | |
| 114 | func (c *cache) Increment(k string, n int64) error { |
| 115 | c.mu.Lock() |
Tested by
no test coverage detected