erhemdiputra / belajar-redis-pubsub-notif

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Belajar redis pub sub notification

How to Run

  1. Install redis
  2. Run command redis-cli CONFIG SET notify-keyspace-events KEA
  3. Run command go build && ./belajar-redis-pubsub-notif
  4. Output
2022/04/04 06:59:25 c.client.Receive() got redis.Subscription: channel=__keyspace*:test_key_*, kind=psubscribe, count=1 - InitSubscriber
2022/04/04 06:59:25 c.client.Receive() got redis.Subscription: channel=__keyspace*:dummy_key_*, kind=psubscribe, count=2 - InitSubscriber
2022/04/04 06:59:25 testCallback: pattern=__keyspace*:test_key_*, channel=__keyspace@0__:test_key_123, message=set
2022/04/04 06:59:25 testCallback: pattern=__keyspace*:test_key_*, channel=__keyspace@0__:test_key_123, message=expire
2022/04/04 06:59:25 testCallback: pattern=__keyspace*:dummy_key_*, channel=__keyspace@0__:dummy_key_123, message=set
2022/04/04 06:59:25 testCallback: pattern=__keyspace*:dummy_key_*, channel=__keyspace@0__:dummy_key_123, message=expire
2022/04/04 06:59:35 testCallback: pattern=__keyspace*:dummy_key_*, channel=__keyspace@0__:dummy_key_123, message=expired
2022/04/04 06:59:35 testCallback: pattern=__keyspace*:test_key_*, channel=__keyspace@0__:test_key_123, message=expired

Source

About


Languages

Language:Go 100.0%