Synchronizing Server & Client Caches

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Niheel
    Recognized Expert Moderator Top Contributor
    • Jul 2005
    • 2432

    Synchronizing Server & Client Caches

    What's the best approach to synchronizing a client cache and a server cache.

    The client cache is there to reduce network calls.
    The server cache is here to reduce database queries.

    If there's an update to the server data, what's the best approach to making sure the client cache is up to date?
    Last edited by Niheel; Aug 30 '19, 12:03 AM.
    niheel @ bytes
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    what exactly is your setup here? a web-application? when using regular http-requests then you cannot push data to the client - so you can only update the cache there with the next request by transferring the new data. other options are websockets or server side events which basically allow for a persistent connection and let you push data to the client in realtime.

    Comment

    • Niheel
      Recognized Expert Moderator Top Contributor
      • Jul 2005
      • 2432

      #3
      It's a server application that will talk to multitude of client applications (web, mobile, desktop, and other services).

      The client caches are to help reduce network calls and also localize data for off-line usability.
      Seems like the best approach is to have the client be responsible for updating the data.
      niheel @ bytes

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        well - websockets for webclients are pretty easy to implement - for mobile devices probably this should be push notifications - since websocktes might tend to drain the device power. if it wouldn't need to be real time then i would use the normal requests to piggyback the new cache data along with them - yea.

        Comment

        Working...