Skip to content

Instantly share code, notes, and snippets.

@anandkunal
Created September 17, 2014 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anandkunal/a2e3451005eac6456bb1 to your computer and use it in GitHub Desktop.
Save anandkunal/a2e3451005eac6456bb1 to your computer and use it in GitHub Desktop.
func (r *RPC) Get(key string, resp *CacheItem) (err error) {
r.mu.RLock()
defer r.mu.RUnlock()
cacheValue, found := r.cache[key]
if !found {
return NotFoundError
}
*resp = CacheItem{key, cacheValue}
r.requests.Get++
return nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment