Delete the value associated with the key key
in the KV Store.
The key to retrieve from within the KV Store. A key cannot:
Gets the value associated with the key key
in the KV Store.
When the key is present, a resolved Promise containing an KVStoreEntry will be returned which contains the associated value.
When the key is absent, a resolved Promise containing null is returned.
The key to retrieve from within the KV Store. A key cannot:
Returns an async iterator for the values of the KV Store optionally taking a prefix and limit
Optional
options: { Optional
Optional
cursor?: stringCursor
The base64 cursor string representing the last listing operation
Optional
limit?: numberLimit the number of keys provided per listing.
Optional
noDo not wait to sync the key list, and instead immediately return the current cached key list.
Optional
prefix?: stringString prefix for keys to list.
Pass this base64 cursor into a subsequent list call to obtain the next listing.
The cursor is undefined when the end of the list is reached.
Write the value of value
into the KV Store under the key key
.
Note: KV Store is eventually consistent, this means that the updated contents associated with the key key
may not be available to read from all
edge locations immediately and some edge locations may continue returning the previous contents associated with the key.
The key to associate with the value. A key cannot:
The value to store within the KV Store.
Optional
options: { Optional
Optional
gen?: numberIf generation match integer.
Optional
metadata?: string | ArrayBufferView | ArrayBufferOptional metadata to be associated with the entry.
If passing a string, UTF-8 encoding is used
Optional
mode?: "overwrite" | "add" | "append" | "prepend"Insert mode, defaults to 'overwrite'.
Optional
ttl?: numberTTL for the entry.
Generated using TypeDoc
Class for accessing a Fastly KV-store.
A kv store is a persistent, globally consistent key-value store.
Note: Can only be used when processing requests, not during build-time initialization.
Example
In this example we connect to an KV Store named
'files'
and save an entry to the store under the key'hello'
and then read back the value and return it to the client.