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
Copy file name to clipboardExpand all lines: README.md
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -460,6 +460,25 @@ Onyx.init({
460
460
});
461
461
```
462
462
463
+
### Using RAM-only keys
464
+
465
+
You can choose not to save certain keys on disk and keep them RAM-only, that way their values will reset with each session. You just have to pass an array of `ramOnlyKeys` to the `Onyx.init` method. You can mark entire collections as RAM-only by including the collection key (e.g., `ONYXKEYS.COLLECTION.TEMP_DATA`). This will make all members of that collection RAM-only. Individual collection member keys cannot be selectively marked as RAM-only.
466
+
467
+
```javascript
468
+
importOnyxfrom'react-native-onyx';
469
+
470
+
Onyx.init({
471
+
keys:ONYXKEYS,
472
+
ramOnlyKeys: [
473
+
ONYXKEYS.RAM_ONLY_KEY_1,
474
+
ONYXKEYS.RAM_ONLY_KEY_2,
475
+
ONYXKEYS.COLLECTION.TEMP_DATA,
476
+
],
477
+
});
478
+
```
479
+
480
+
> Note: RAM-only keys still consume memory and will remain in cache until explicitly cleared or until Onyx.clear() is called. Use them judiciously for truly ephemeral data.
481
+
463
482
### Usage
464
483
465
484
The extension interface is pretty simple, on the left sidebar you can see all the updates made to the local storage, in ascending order, and on the right pane you can see the whole the current state, payload of an action and the diff between the previous state and the current state after the action was triggered.
0 commit comments