Skip to content

Latest commit

 

History

History
37 lines (30 loc) · 822 Bytes

golang_redis_example.md

File metadata and controls

37 lines (30 loc) · 822 Bytes

golang_redis example for Tile38

golang_redis project page

All Tile38 commands should use redis.NewStringCmd(...args) to orgnize parameters, then, use Process() to request result ,and get result by using Result().

Install the golang_redis library:

go get gopkg.in/redis.v5

Complete example:

import (
	redis "gopkg.in/redis.v5"
 	"log"
)
func testTile38(){
	client := redis.NewClient(&redis.Options{
		Addr: "127.0.0.1:9851",
	})
	cmd := redis.NewStringCmd("SET", "fleet", "truck", "POINT", 33.32, 115.423)
	client.Process(cmd)
	v, _ := cmd.Result()
	log.Println(v)
	cmd1 := redis.NewStringCmd("GET", "fleet", "truck")
	client.Process(cmd1)
	v1, _ := cmd1.Result()
	log.Println(v1)
}

func main(){
  testTile38()
}