Get and Touch the item with the provided key. The error ErrCacheMiss is returned if the item didn't already exist in the cache.
(key string, expiration int32)
| 753 | // Get and Touch the item with the provided key. The error ErrCacheMiss is |
| 754 | // returned if the item didn't already exist in the cache. |
| 755 | func (c *Client) GetAndTouch(key string, expiration int32) (item *Item, err error) { |
| 756 | err = c.withKeyAddr(key, func(addr net.Addr) error { |
| 757 | return c.getAndTouchFromAddr(addr, key, expiration, func(it *Item) { item = it }) |
| 758 | }) |
| 759 | if err == nil && item == nil { |
| 760 | err = ErrCacheMiss |
| 761 | } |
| 762 | return |
| 763 | } |
| 764 | |
| 765 | func (c *Client) getAndTouchFromAddr(addr net.Addr, key string, expiration int32, cb func(*Item)) error { |
| 766 | return c.withAddrRw(addr, func(conn *conn) error { |
nothing calls this directly
no test coverage detected