Skip to content

Commit b3f9142

Browse files
authored
✏ Tighten up docs for SimpleCache.getOrSet (#694)
1 parent 3651e3e commit b3f9142

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

documentation/docs/fastly:cache/SimpleCache/getOrSet.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pagination_prev: null
66
---
77
# SimpleCache.getOrSet
88

9-
The **`getOrSet()`** method attempts to get an entry from the cache for the supplied `key` if no entry is found (or has expired), the supplied `set` function is executed and it's result is inserted into the cache under the supplied `key` and for the supplied `ttl` (Time-To-Live) duration, provided in seconds.
9+
The **`getOrSet()`** method attempts to get an entry from the cache for the supplied `key`. If no entry is found (or has expired), the supplied `set` function is executed and its result is inserted into the cache under the supplied `key` and for the supplied `ttl` (Time-To-Live) duration, provided in seconds.
1010

1111
## Syntax
1212

@@ -20,14 +20,14 @@ getOrSet(key, set, length)
2020
- `key` _: string_
2121
- The key to lookup and/or store the supplied entry under within the cache.
2222
- `set` _: Function_
23-
- : A function to execute when the cache does not have a usable entry for the supplied `key`.
23+
- The function to execute if and only if the cache does not have a usable entry for the supplied `key`.
2424
The function should return a Promise which resolves with the following interface:
25-
- `value` _: ArrayBuffer | TypedArray | DataView| ReadableStream | URLSearchParams | String | string literal_
25+
- `value` _: ArrayBuffer | TypedArray | DataView | ReadableStream | URLSearchParams | String | string literal_
2626
- The value to store within the cache.
2727
- `ttl` _: number_
28-
- The number of seconds to store the supplied entry within the cache for.
28+
- The maximum number of seconds to store the supplied entry in the cache.
2929
- `length` _: number_ __optional__
30-
- The length of value being stored within the cache. This is only used when the `value` is a ReadableStream.
30+
- The length of the value being stored within the cache. This is only used when the `value` is a `ReadableStream`.
3131

3232
### Return value
3333

@@ -47,7 +47,7 @@ Returns a `SimpleCacheEntry`.
4747

4848
## Examples
4949

50-
In this example we attempt to retrieve an entry from the Fastly Cache, if the entry does not exist, we create the content and insert it into the Fastly Cache before finally returning.
50+
In this example we attempt to retrieve an entry from the Fastly Cache. If the entry does not exist, we create the content and insert it into the Fastly Cache before finally returning.
5151

5252
```js
5353
/// <reference types="@fastly/js-compute" />

0 commit comments

Comments
 (0)