---
title: lookup
summary: Returns a LookupBuilder that will perform a non-transactional cache lookup.
url: https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/core/fn.lookup/
---

**Kind:** Function  
**Module:** [core](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/core/)  
**Package:** compute-sdk-cpp 0.7.0

Returns a [`LookupBuilder`](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/core/class.LookupBuilder/) that will perform a non-transactional cache lookup.

In contrast to [`Transaction::lookup()`](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/core/class.Transaction/#method-lookup), a non-transactional lookup will not attempt to coordinate with any concurrent cache lookups. If two instances of the service perform a lookup at the same time for the same cache key, and the item is not yet cached, they will both get nothing from the eventual lookup execution. Without further coordination, they may both end up performing the work needed to [`insert()`](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/core/fn.insert/) the item (which usually involves origin requests and/or computation) and racing with each other to insert.

To resolve such races between concurrent lookups, use [`Transaction::lookup()`](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/core/class.Transaction/#method-lookup) instead.

_Overload 1 of 2_

```cpp
LookupBuilder fastly::cache::core::lookup(std::span<const std::uint8_t> key)
```

**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/cache/core.h#L880

Returns a [`LookupBuilder`](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/core/class.LookupBuilder/) that will perform a non-transactional cache lookup.

In contrast to [`Transaction::lookup()`](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/core/class.Transaction/#method-lookup), a non-transactional lookup will not attempt to coordinate with any concurrent cache lookups. If two instances of the service perform a lookup at the same time for the same cache key, and the item is not yet cached, they will both get nothing from the eventual lookup execution. Without further coordination, they may both end up performing the work needed to [`insert()`](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/core/fn.insert/) the item (which usually involves origin requests and/or computation) and racing with each other to insert.

To resolve such races between concurrent lookups, use [`Transaction::lookup()`](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/core/class.Transaction/#method-lookup) instead.

**Parameters**

- `key`: `std::span<const std::uint8_t>`

**Returns**

`LookupBuilder`

_Overload 2 of 2_

```cpp
LookupBuilder fastly::cache::core::lookup(std::string_view key)
```

**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/cache/core.h#L883

Non-transactional cache lookup with string key.

**Parameters**

- `key`: `std::string_view`

**Returns**

`LookupBuilder`
