Local cache for iCloud database?
Basically, an app needs to work with data. If the data happens to come from a remote database, the core operation of the app relies upon the internet connection.
And, it’s critical that the app implements the app-life-cycle-free local cache so that the most recent status is not lost in the app’s point of view. Otherwise, when the user opens the app and finds nothing on the view, and it feels like his/her own data is all gone.
Core Data can serve as local cache. If local cache needs to be implemented in an app that works with data that comes from iCloud database, what does that take?
Without local caching, the data flow starts from the iCloud, and the app takes the data and store it in-memory. That’s it. The data flow ends there. The app works with that data.
And, if you allow local caching, how does that work in that data flow? Instead of iCloud-InMemory, it should be iCloud-CoreData-InMemory.
What I need is an object that bridges the gap between iCloud and InMemory. Then, how does that object works? What are the core functionalities of the object?
I need to know the list of record types on the iCloud database. What kind of records exist? so that I can structure core data entities for them.
Users, Thread, Conversation. What are they? Conversation means a chat bubble, message, sender, date when it is created.
A group of conversation makes a thread.
Thread can be owned by many users.
imagine a chatroom. many users can participate the chatroom.
Chatroom has one-to-many relationship to the users that owns it.
A user can create a chatroom and invite other users. A chatroom is modelled as a thread.
A thread has one-to-many relationships with the users that own the thread.