Get gets the item for the given key. ErrCacheMiss is returned for a memcache cache miss. The key must be at most 250 bytes in length.
(key string)
| 333 | // Get gets the item for the given key. ErrCacheMiss is returned for a |
| 334 | // memcache cache miss. The key must be at most 250 bytes in length. |
| 335 | func (c *Client) Get(key string) (item *Item, err error) { |
| 336 | err = c.withKeyAddr(key, func(addr net.Addr) error { |
| 337 | return c.getFromAddr(addr, []string{key}, func(it *Item) { item = it }) |
| 338 | }) |
| 339 | if err == nil && item == nil { |
| 340 | err = ErrCacheMiss |
| 341 | } |
| 342 | return |
| 343 | } |
| 344 | |
| 345 | // Touch updates the expiry for the given key. The seconds parameter is either |
| 346 | // a Unix timestamp or, if seconds is less than 1 month, the number of seconds |