mdataListEntries() does not "see" new entries, how to invalidate cache?

I am working on my proof-of-concept chat app. There are 2 parties sending messages to each other each using its own mdata for its messages.

The problem is that after a mdata is modified the remote party does not “see” the new entry in the mdata, i.e. calling mdataListEntries() returns just the old entries.

If the app is restarted, i.e. mdata deserialized again new entries are present.

Is there some caching going on internally, how to invalidate this cache in order to retrieve the new entries?

2 Likes

Hey @ogrebgr!

When you call mdataListEntries() passing an EntryHandle it just fetches the list of entries from the MData that was fetched when you called NativeBindings.mdataEntries().

In order to refresh the entries, you’ll need to fetch a new EntriesHandle using NativeBindings.mdataEntries() and then use that handle to call mdataListEntries

Also, a quick note about this, the entire MutableData is not serialized and stored. Just the MDataInfo i.e. Address, TypeTag and encryption keys are serialized and stored. So that they can be fetched from a deterministic location ( prolly a container ) and used to fetch the entire MutableData with the entries.

3 Likes

Thanks @lionel.faber. Can you include this in the docs? Nuggets like this are gold! :slight_smile:

1 Like