---
title: PendingTransaction
summary: A cache transaction suspended between lookup and response.
url: https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/core/class.PendingTransaction/
---

**Kind:** Class  
**Module:** [core](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/core/)  
**Package:** compute-sdk-cpp 0.7.0  
**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/cache/core.h#L389

Include `fastly/cache/core.h` to use this class.

A cache transaction suspended between lookup and response.

This handle is produced by [`TransactionLookupBuilder::execute_async()`](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/core/class.TransactionLookupBuilder/#method-execute_async).

Callers can check whether or not the request was instructed to wait behind another caller by calling [`PendingTransaction::pending()`](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/core/class.PendingTransaction/#method-pending), and can complete the request (returning a [`Transaction`](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/core/class.Transaction/)) by calling [`PendingTransaction::wait()`](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/core/class.PendingTransaction/#method-wait).

## Methods

### pending

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

```cpp
tl::expected<bool, CacheError> fastly::cache::core::PendingTransaction::pending() const
```

Returns `true` if this request was instructed to wait for another request to insert the looked-up item, and `false` otherwise.

Note that, even if [`pending()`](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/core/class.PendingTransaction/#method-pending) returns `true`, the [`Transaction`](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/core/class.Transaction/) returned by [`wait()`](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/core/class.PendingTransaction/#method-wait) may still be required to insert (or update) the object. This can happen if the caller providing the item called [`Transaction::cancel_insert_or_update()`](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/core/class.Transaction/#method-cancel_insert_or_update) or encountered an error.

**Returns**

`tl::expected<bool, CacheError>`

### wait

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

```cpp
tl::expected<Transaction, CacheError> fastly::cache::core::PendingTransaction::wait() &&
```

Returns the [`Transaction`](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/core/class.Transaction/) resulting from the lookup that produced this [`PendingTransaction`](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/cache/core/class.PendingTransaction/), waiting for another caller to provide the requested item if necessary.

**Returns**

`tl::expected<Transaction, CacheError>`
