Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Batching #535

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

feat: Batching #535

wants to merge 2 commits into from

Conversation

mrousavy
Copy link
Owner

@mrousavy mrousavy commented Apr 11, 2023

const storage = new MMKV()

storage.batch((s) => {
  s.set('hello', 'world')
  s.set('test', 'another')
  s.set('someLargeBuffer', buffer)
})

@adhorodyski
Copy link

Love the feature!
I've been playing with the library lately for https://github.com/Expensify/App and have a quick question - as far as I understand this will trigger addOnValueChangedListener for each updated key (20k keys when eg. populating will do 20k events etc), do you think it might be worth to have a separate listener notifying about the batched updates being applied? Like a addOnBatchedValuesChangedListener 😅 that will trigger only once.

@mrousavy
Copy link
Owner Author

Hey - yea for listeners we should maybe batch that as well then. 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants