MCPcopy
hub / github.com/bradfitz/gomemcache / GetAndTouch

Method GetAndTouch

memcache/memcache.go:755–763  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
755func (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
765func (c *Client) getAndTouchFromAddr(addr net.Addr, key string, expiration int32, cb func(*Item)) error {
766 return c.withAddrRw(addr, func(conn *conn) error {

Callers

nothing calls this directly

Calls 2

withKeyAddrMethod · 0.95
getAndTouchFromAddrMethod · 0.95

Tested by

no test coverage detected