Conditional Push Notifications in Redis

41 views
Skip to first unread message

Kashyap Mhaisekar

unread,
May 15, 2015, 8:11:22 PM5/15/15
to redi...@googlegroups.com
Hi,
I am looking for a possibility of having Conditional Push Notifications from Redis. Is it possible?

For example,
I have a key say, "counter" in redis.

My java code (Across 30 machines) keep incrementing the counter by INCR. I wanted to be able to generate a notification from REDIS on a channel ONLY when the count reaches 1000.

Do you think it is possible?

Regards,
Kashyap

Josiah Carlson

unread,
May 15, 2015, 9:09:05 PM5/15/15
to redi...@googlegroups.com
Trivially done with a Lua script.

 - Josiah


--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at http://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.

Kashyap Mhaisekar

unread,
May 15, 2015, 10:03:08 PM5/15/15
to redi...@googlegroups.com

Best piece I received today. Thanks.

Kashyap Mhaisekar

unread,
May 15, 2015, 10:06:54 PM5/15/15
to redi...@googlegroups.com

Since a redis runs only one lua script at a time, does there have to be a transaction in lua for appending kind of calls?

Jan-Erik Rediger

unread,
May 16, 2015, 3:34:26 AM5/16/15
to redi...@googlegroups.com
A Lua script itself is already kind of a transaction in that it executes
atomically. Redis is single-threaded and thus can only process one
command at a time, so while your EVAL is executing the Lua script, no
other client can issue commands in between.

On Fri, May 15, 2015 at 09:06:50PM -0500, Kashyap Mhaisekar wrote:
> Since a redis runs only one lua script at a time, does there have to be a
> transaction in lua for appending kind of calls?
> On May 15, 2015 21:03, "Kashyap Mhaisekar" <kash...@gmail.com> wrote:
>
> > Best piece I received today. Thanks.
> > On May 15, 2015 20:09, "Josiah Carlson" <josiah....@gmail.com> wrote:
> >
> >> Trivially done with a Lua script.
> >>
> >> - Josiah
> >>
> >>
> >> On Fri, May 15, 2015 at 5:11 PM, Kashyap Mhaisekar <kash...@gmail.com>
> >> wrote:
> >>
> >>> Hi,
> >>> I am looking for a possibility of having Conditional Push Notifications
> >>> from Redis. Is it possible?
> >>>
> >>> For example,
> >>> I have a key say, "counter" in redis.
> >>>
> >>> My java code (Across 30 machines) keep incrementing the counter by INCR.
> >>> I wanted to be able to generate a notification *from* REDIS on a
> >>> channel *ONLY* when the count reaches 1000.
Reply all
Reply to author
Forward
0 new messages