Edward Brey
Edward Brey

Reputation: 41658

Seamlessly updating a large collection of Redis keys and values

I have a large collection of Redis key/value pairs in some namespace (i.e. the key has some prefix). The source for this collection is updated periodically; it mostly stays the same, but some keys are added, others are removed, and some have updated values.

What is an efficient way to update the collection in Redis without any downtime to the application using the collection? It is not required that the update be atomic.

Upvotes: 1

Views: 877

Answers (1)

Edward Brey
Edward Brey

Reputation: 41658

  1. Calculate a sync delta (add, removes, updates) between the existing Redis collection and the updated source collection.
  2. Update the Redis collection using the sync delta.

Depending on how frequent the source updates are, you may want to keep the local copy of the existing Redis collection in memory to speed up step 1 and take load off the Redis server.

Upvotes: 2

Related Questions