TransactionCacheEntry

Classin cache@fastly/js-compute 4.0.0since 3.9.0View source

Extends CacheEntry.

Represents a cached item retrieved via a transactional lookup (CoreCache.transactionLookup). Extends CacheEntry with methods for inserting, updating, and cancelling cache transactions.

Methods

cancel(): void

Cancel an obligation to provide an object to the cache.

Returns

void

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

insertAndStreamBack

View source
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

update(options: TransactionUpdateOptions): void

Perform an update of the cache item's metadata.

Parameters

options: TransactionUpdateOptions

Returns

void