- ext
- redis
- redis.pl -- Redis client
- redis_server/3
- redis_connect/1
- redis_connect/3
- tls_verify/5
- sentinel_slave/4
- redis_disconnect/1
- redis_disconnect/2
- redis/2
- redis/3
- redis/1
- redis_write/2
- redis_read/2
- redis_get_list/3
- redis_get_list/4
- redis_set_list/3
- redis_get_hash/3
- redis_set_hash/3
- redis_array_dict/3
- redis_scan/3
- redis_sscan/4
- redis_hscan/4
- redis_zscan/4
- redis_current_command/2
- redis_current_command/3
- redis_property/2
- redis_subscribe/4
- redis_subscribe/2
- redis_unsubscribe/2
- redis_current_subscription/2
- redis_streams.pl -- Using Redis streams
- redis.pl -- Redis client
- redis
- redis_subscribe(+Redis, +Channels, -Id, +Options) is det
- Subscribe to one or more Redis PUB/SUB channels. This predicate
creates a thread using thread_create/3 with the given Options. Once
running, the thread listens for messages. The message content is a
string or Prolog term as described in redis/3. On receiving a
message, the following message is broadcasted:
redis(Id, Channel, Data)
If redis_unsubscribe/2 removes the last subscription, the thread terminates.
To simply print the incomming messages use e.g.
?- listen(redis(_, Channel, Data), format('Channel ~p got ~p~n', [Channel,Data])). true. ?- redis_subscribe(default, test, Id, []). Id = redis_pubsub_3, ?- redis(publish(test, "Hello world")). Channel test got "Hello world" 1 true.
- Arguments:
-
Id - is the thread identifier of the listening thread. Note that the Options alias(Name)
can be used to get a system wide name.