Beispiel #1
0
func MakeRedis(host, password string) *redis.Redis {
	return redis.MakeRedis(host, password)
}
Beispiel #2
0
func echoEngine() *G.Gilmour {
	r := redis.MakeRedis("127.0.0.1:6379", "")
	engine := G.Get(r)
	return engine
}
	"time"

	r "gopkg.in/gilmour-libs/gilmour-e-go.v5/backends/redis"
	"gopkg.in/gilmour-libs/gilmour-e-go.v5/proto"
	"gopkg.in/gilmour-libs/gilmour-e-go.v5/ui"
)

const (
	PingTopic    = "ping"
	PingResponse = "pong"
	SleepTopic   = "sleepy-ping"
)

var engine *Gilmour

var redis = r.MakeRedis("127.0.0.1:6379", "")

var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")

func randSeq(n int) string {
	rand.Seed(time.Now().UTC().UnixNano())
	b := make([]rune, n)
	for i := range b {
		b[i] = letters[rand.Intn(len(letters))]
	}
	return string(b)
}

func isReplySubscribed(topic string) (bool, error) {
	return isTopicSubscribed(topic, false)
}