Caching in Background

I am having problem in caching data in my messaging function of my app. In my app connected people can send message. Buy I cannot make the app checking data and caching both in background like whatsapp. I see whatsapp always check message in background. Whenever I open whatsapp it shows the message sender list instantly with sorting all the message by the sent time. But if I use caching, my app only show the last cached message sender list instantly. it doesn’t update the cache in background. I want my app will

  1. Check the message in background at timely interval like every 1 minute and caching the data.
  2. Sorting the message sender list with their last message time in background.
    So that whenever I open the app it can show all the message sender with unread message on top instantly.