Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
55 lines (34 sloc) 1.16 KB

exp-godis

godis/exp - an experimental Redis client for Go. It supports commands and features through a simple API which aims to be is easy to use.

  1. Package docs
  2. Source code

Install godis

godis/exp is available at github.com. Get it by running.

$ go get github.com/simonz05/godis/exp

Importing godis/exp will add a redis context to program.

Use exp-godis

A few examples are included. The following demonstrates SET and GET. See example/ for more.

package main

import (
    "github.com/simonz05/godis/exp"
)

func main() {
    c := redis.NewClient("tcp:127.0.0.1:6379")

    res, err := c.Call("SET", "foo", "bar")

    if err != nil {
        println(err.Error())
        return
    }

    res, _ = c.Call("GET", "foo")
    println("GET foo:", res.Elem.String())
}

Build and run the example.

$ make string; ./string

You should see the following printed in the terminal.

GET foo: bar 

In case your redis server isn't running, you'll get an error.

ERR 127.0.0.1:6379
Jump to Line
Something went wrong with that request. Please try again.