Fritzy.io

Redis Lua: Updating a Key and Publishing a Logged Notification

redislua

One of the cool things about Redis Lua scripting is the ability to publish notifications of your changes atomically with those changes made.
There's actually a new Redis feature that can do this for you if configured: keyspace notifications.
But maybe you want to send out a single notification from a script that does several things, and this keeps a log of notifications.

You could also use an iterator id so that clients can make sure they've received every notification.

P.S. I've been busy today, but I'd like these to be happening every work day, regardless of whether I go to work or not, so here's a late-day entry.