Skip to content

Commit 131f253

Browse files
authored
chore: [FFM-6891]: Update JS SDK and caching docs (#7)
1 parent 21e5672 commit 131f253

File tree

4 files changed

+34
-13
lines changed

4 files changed

+34
-13
lines changed

README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,10 @@ The React Client SDK's asynchronous mode allows this by passing the optional `as
108108
## Caching evaluations
109109

110110
In practice flags rarely change and so it can be useful to cache the last received evaluations from the server to allow
111-
your application to get started as fast as possible. Setting the `cache` option as `true` will allow the SDK to store
112-
its evaluations to `localStorage` and retrieve at startup. This lets the SDK get started near instantly and begin
113-
serving flags, while it carries on authenticating and fetching up-to-date evaluations from the server behind the scenes.
111+
your application to get started as fast as possible. Setting the `cache` option as `true` or as an object (see interface
112+
below) will allow the SDK to store its evaluations to `localStorage` and retrieve at startup. This lets the SDK get
113+
started near instantly and begin serving flags, while it carries on authenticating and fetching up-to-date evaluations
114+
from the server behind the scenes.
114115

115116
```typescript jsx
116117
<FFContextProvider
@@ -127,6 +128,14 @@ serving flags, while it carries on authenticating and fetching up-to-date evalua
127128
</FFContextProvider>
128129
```
129130

131+
The `cache` option can also be passed as an object with the following options.
132+
133+
```typescript
134+
export interface CacheOptions {
135+
ttl?: number // maximum age of stored cache, in ms, before it is considered stale
136+
}
137+
```
138+
130139
## API
131140

132141
### `FFContextProvider`

examples/get-started/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 19 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"react": ">=16.7.0"
2222
},
2323
"dependencies": {
24-
"@harnessio/ff-javascript-client-sdk": "^1.9.1",
24+
"@harnessio/ff-javascript-client-sdk": "^1.10.0",
2525
"lodash.omit": "^4.5.0"
2626
},
2727
"devDependencies": {

0 commit comments

Comments
 (0)