![]() I did my test in local server, what should i expect when i move it to production server -shared host to be precise?.I'm storing each message in a separate file to avoid concurrency or data curruption while writing and reading messages. This approach is actually doing well for me, in fact i sent and receive 1000 messages to a single recipient( just for test though, in the real sense there will only be maximum of 300 files(messages) in a recipients folder) To get messages, i will read ids in "message_ids.txt", explode it and foreach id i file_get_content("$id.txt") to fetch the messages and delete immediately. Message_ids.txt will contain chat ids of the messages only in this format (space separated ids) : 3271374 4671366 0681366 ![]() See structure below /chats/RECIPIENT_USERNAME/ Each message can only contain at most 10kb of data. ![]() ![]() I'm building an android chat app and i have been worried about a good way to store chat messages (these messages will be deleted from the server immediately when they are delivered)Ĭurrently, i'm using this approach to store the chat messages: Each single message has a separate file in recipient's folder and it's named after chat id like: 3271374.txt. Though answers might be opinion based but i felt SO is the right place to get my question and curiosity answered from expert in file manipulation as i'm still learning. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |