T
TanStack3y ago
foreign-sapphire

Is it possibleHow can i use multiple keys for createAsyncStorage ?

Currently i have simple persister implemented for React Native project that uses mmkv storage with PersistedQueryClient. So far it seems to store all react query cache data under single cache key. and single entry. Id like to use multiple because some of the queries are several megabytes of base64 strings which id like to persist. It is realistic to have dozens if not hundred + mb in cache this way and id like to avoid reading all of it at once when getItem gets called. Is there a way to segregate the persisted storage cache items?
2 Replies
flat-fuchsia
flat-fuchsia3y ago
not right now. There's a discussion going on here: https://github.com/TanStack/query/discussions/2649
GitHub
Memory-friendly per-query disk caching API · Discussion #2649 · Tan...
The current persistor API and experimental implementations for both web and React Native will work for minor use cases, however the general approach isn't easy to make performant as it assu...
foreign-sapphire
foreign-sapphireOP3y ago
Cheers for the reply. Shame i cant do it atm the way id like. Ill just do manual storage then. Sadly not smart enough to open a PR/Proposal to add the multicache option as a library plugin.

Did you find this page helpful?