---
title: Lookup
summary: 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.
url: https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/cache/core/fn.Lookup/
---

**Kind:** Function  
**Module:** [core](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/cache/core/)  
**Package:** compute-sdk-go v1.11.0  
**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/cache/core/core.go#L308

```go
func Lookup(key []byte, opts LookupOptions) (*Found, error)
```

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](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/cache/core/fn.NewTransaction/), this will not
coordinate with any concurrent cache lookups.  No request collapsing
is done.

**Parameters**

- `key`: `[]byte`
- `opts`: `LookupOptions`

**Returns**

`(*Found, error)`

```go
f, 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)
```
