You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat!: Rename SimpleCache.delete to SimpleCache.purge and require purge options to be supplied as the second parameter
We are renaming because "purge" is already a well-known and documented concept for removing content from Fastly's cache.
The second argument allows the caller to decide what scope to purge the content from, currently they can choose to purge from all of Fastly ("global") or from the POP that contains the currently executing instance ("pop"). We do not provide a default option right now, in the future we may provide a default option, if we discover a common pattern is being used.
purge the entry associated with the key `key` from the cache.
11
+
12
+
## Syntax
13
+
14
+
```js
15
+
purge(key, options)
16
+
```
17
+
18
+
### Parameters
19
+
20
+
-`key`_: string_
21
+
- The key to purge from within the cache.
22
+
23
+
-`options`_: object_
24
+
-`scope`_: string_
25
+
- : Where to purge the content from.
26
+
- Possible values are:
27
+
- "global" - This will remove the content from all of Fastly.
28
+
- "pop" - This will remove the content from the POP that contains the currently executing instance.
29
+
-`headers`
30
+
- : Any headers you want to add to your request, contained
31
+
within a `Headers` object or an object literal with `String` values.
32
+
-`body`
33
+
- : Any body that you want to add to your request: this can be an `ArrayBuffer`, a `TypedArray`, a `DataView`, a `URLSearchParams`, string object or literal, or a `ReadableStream` object.
34
+
-`backend`_**Fastly-specific**_
35
+
-`cacheOverride`_**Fastly-specific**_
36
+
-`cacheKey`_**Fastly-specific**_
37
+
38
+
### Return value
39
+
40
+
Returns `undefined`.
41
+
42
+
### Exceptions
43
+
44
+
-`TypeError`
45
+
- If the provided `key`:
46
+
- Is an empty string
47
+
- Cannot be coerced to a string
48
+
- Is longer than 8135 characters
49
+
50
+
## Examples
51
+
52
+
In this example, when a request contains a `purge` querystring parameter, we purge the an entry from the cache.
0 commit comments