Esempio n. 1
0
func NewRedisQueue(config Config, key string) *RedisQueue {
	port := strconv.Itoa(config.Port)

	queue := redismq.CreateBufferedQueue(config.Host,
		port,
		config.Password,
		config.Db,
		key,
		recvBuffer)
	queue.Start()

	return &RedisQueue{queue: queue,
		data:   make(chan string),
		term:   make(chan bool),
		ticker: *time.NewTicker(time.Duration(redisFlushInterval) * time.Second)}
}
Esempio n. 2
0
// This example demonstrates maximum performance
func main() {
	runtime.GOMAXPROCS(8)
	server := redismq.NewServer("localhost", "6379", "", 9, "9999")
	server.Start()
	testQueue := redismq.CreateBufferedQueue("localhost", "6379", "", 9, "example", 200)
	err := testQueue.Start()
	if err != nil {
		panic(err)
	}
	go write(testQueue)

	go read(testQueue, "1")
	go read(testQueue, "2")
	go read(testQueue, "3")
	go read(testQueue, "4")
	go read(testQueue, "5")
	go read(testQueue, "6")
	go read(testQueue, "7")
	go read(testQueue, "8")

	select {}
}