---
title: TransactionCacheEntry
summary: Represents a cached item retrieved via a transactional lookup (CoreCache.transactionLookup). Extends CacheEntry with methods for inserting, updating, and cancelling cache transactions.
url: https://www.fastly.com/documentation/reference/compute/sdks/javascript/js-compute/cache/class.TransactionCacheEntry/
---

**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.9.0  
**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/cache.d.ts#L501

Extends `CacheEntry`.

Represents a cached item retrieved via a transactional lookup ([CoreCache.transactionLookup](https://www.fastly.com/documentation/reference/compute/sdks/javascript/js-compute/cache/class.CoreCache/#method-transactionLookup)).
Extends [CacheEntry](https://www.fastly.com/documentation/reference/compute/sdks/javascript/js-compute/cache/class.CacheEntry/) with methods for inserting, updating, and cancelling cache transactions.

## Methods

### cancel

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

```javascript
cancel(): void
```

Cancel an obligation to provide an object to the cache.

**Returns**

`void`

### insert

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

```javascript
insert(options: TransactionInsertOptions): FastlyBody
```

Perform a transactional cache insertion, returning a `FastlyBody` instance for providing the cached object itself.

This method should only be called when `TransactionCacheEntry.state().mustInsertOrUpdate()` is true; otherwise, an error will be thrown when attempting to perform the insertion.

**Parameters**

- `options`: `TransactionInsertOptions`

**Returns**

`FastlyBody`

### insertAndStreamBack

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

```javascript
insertAndStreamBack(options: TransactionInsertOptions): [FastlyBody, CacheEntry]
```

Perform a transactional cache insertion, returning a `FastlyBody` instance for providing the cached object itself, and a `CacheEntry` instance which can be used to stream out the newly-inserted cache item.

For the insertion to complete successfully, the object must be written into the returned `FastlyBody` instance, and then `FastlyBody.prototype.close` must be called.
If `FastlyBody.prototype.close` does not get called, the insertion is considered incomplete, and any concurrent lookups that may be reading from the object as it is streamed into the cache may encounter a streaming error.

**Parameters**

- `options`: `TransactionInsertOptions`

**Returns**

`[FastlyBody, CacheEntry]`

### update

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

```javascript
update(options: TransactionUpdateOptions): void
```

Perform an update of the cache item's metadata.

**Parameters**

- `options`: `TransactionUpdateOptions`

**Returns**

`void`
