Lookup
Lookup performs a simple, non-transactional lookup for the given key. If the key is not cached, [ErrNotFound] is returned. Keys can be up to 4096 bytes in length.
In contrast to lookups using NewTransaction, this will not coordinate with any concurrent cache lookups. No request collapsing is done.
Parameters
- key: []byte
- opts: LookupOptions
Returns
(*Found, error)
123456789101112f, err := core.Lookup([]byte("my_key"), core.LookupOptions{})if err != nil { panic(err)}defer f.Body.Close()
cachedStr, err := io.ReadAll(f.Body)if err != nil { panic(err)}
fmt.Printf("The cached value was: %s", cachedStr)