---
title: PendingTransaction
summary: A transactional cache lookup issued via CoreCache.transactionLookupAsync that has not yet resolved.
url: https://www.fastly.com/documentation/reference/compute/sdks/javascript/js-compute/cache/class.PendingTransaction/
---

**Kind:** Class  
**Module:** [cache](https://www.fastly.com/documentation/reference/compute/sdks/javascript/js-compute/cache/)  
**Package:** @fastly/js-compute 4.0.1  
**Since:** 3.46.0  
**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/cache.d.ts#L312

A transactional cache lookup issued via [CoreCache.transactionLookupAsync](https://www.fastly.com/documentation/reference/compute/sdks/javascript/js-compute/cache/class.CoreCache/#method-transactionLookupAsync) that has
not yet resolved.

## Constructor

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/cache.d.ts#L313

```javascript
new PendingTransaction()
```

## Methods

### pending

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/cache.d.ts#L321

```javascript
pending(): boolean
```

Returns `true` if the transaction lookup has not yet resolved.

This is a non-blocking check, and can be called any number of times before `wait()` is
called.

**Returns**

`boolean`

### wait

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/cache.d.ts#L337

```javascript
wait(timeoutMs?: number): Promise<TransactionCacheEntry>
```

Waits for the transaction lookup to resolve, returning a `TransactionCacheEntry` — the
same value that `CoreCache.transactionLookup()` would have returned had it been called
instead.

If `timeoutMs` is provided and the lookup does not resolve within that many milliseconds,
the returned promise rejects, and the pending lookup is released so that it no longer
holds up e.g. other transactional lookups for the same key.

`wait()` can only be called once per `PendingTransaction`; calling it again throws.

**Parameters**

- `timeoutMs`: `number` (optional) — The maximum number of milliseconds to wait for the lookup to resolve.

**Returns**

`Promise<TransactionCacheEntry>`

**Throws**

- If `timeoutMs` elapses before the lookup resolves, or if `wait()` has already been called on this `PendingTransaction`.
