Apollo-android: Usage of writeTransaction and writeAndPublish

Created on 12 Jun 2020  路  2Comments  路  Source: apollographql/apollo-android

Supposed I want to write and publish an opration to ApolloStore. I can use the writeAndPublish method directly and it seems to work. But there's also writeTransaction method, which aquires the lock for writing the store. Should I use it at all times? When is it safe to just write to the store without acquiring the lock, and when I should make sure to have the lock acquired?

Also writeTransaction method is public, but it accepts a Transaction, which belongs to com.apollographql.apollo.cache.normalized.internal package. Is it safe to use it despite internal package?

Question

All 2 comments

writeAndPublish calls writeTransaction under the hood so it should be safe to use that.

Regarding internal packages, it's safer to not rely on them as implementation might change without warning.

Thank you :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gmrandom picture gmrandom  路  4Comments

sav007 picture sav007  路  4Comments

RageshAntony picture RageshAntony  路  3Comments

TayfunCesur picture TayfunCesur  路  4Comments

rnitame picture rnitame  路  3Comments