InMemory 그룹을 redis로 변경

This commit is contained in:
2023-07-19 09:37:02 +09:00
parent 01da5bb3a4
commit 8e1b232d57
8 changed files with 209 additions and 448 deletions

View File

@ -3,16 +3,37 @@ package core
import (
"context"
"fmt"
"testing"
"time"
"github.com/go-redis/redis/v8"
"go.mongodb.org/mongo-driver/bson/primitive"
"repositories.action2quare.com/ayo/gocommon"
"repositories.action2quare.com/ayo/gocommon/logger"
)
func TestPubSub(t *testing.T) {
opt0, _ := redis.ParseURL("redis://192.168.8.94:6380/0")
opt1, _ := redis.ParseURL("redis://192.168.8.94:6380/1")
rc0 := redis.NewClient(opt0)
rc1 := redis.NewClient(opt1)
go func() {
time.Sleep(time.Second)
rc1.Publish(context.Background(), "__testchan", "real???")
fmt.Println("published")
}()
pubsub := rc0.Subscribe(context.Background(), "__testchan")
msg, err := pubsub.ReceiveMessage(context.Background())
fmt.Println(msg.Payload, err)
}
func TestReJSON(t *testing.T) {
rc := redis.NewClient(&redis.Options{Addr: "192.168.8.94:6380"})
rh := NewRedisonHandler(context.Background(), rc)
rh := gocommon.NewRedisonHandler(context.Background(), rc)
testDoc := map[string]any{
"members": map[string]any{