Skip to content

JanBerktold/go-memcachey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-memcachey

GoDoc CircleCI

go-memcachey is a Golang client library for the Memcached in-memory database. See godoc for documentation.

Example

Basic Example

import "github.com/janberktold/go-memcachey"

func main() {
    client, _ := memcachey.NewClient([]string{"127.0.0.1:11211"})

    // Set a value to Memcached
    client.Set("some_key", []byte{1, 2, 3})

    // Read the value back
    value, _ := client.Get("some_key")

    fmt.Printf("Read %v from Memcached!", value)
}

Customized client

func main() {
    client, _ := memcachey.NewClient([]string{"127.0.0.1:11211"},
                    memcachey.WithConsistentHashing(),
                    memcachey.WithPoolLimitsPerHost(20, 100),
                    memcachey.WithTimeouts(10 * time.Second))

    // Read a value from Memcached
    value, _ := client.Get("some_key")

    fmt.Printf("Read %v from Memcached!", value)
}

Contributing

Testing

This client includes a testing suite which runs commands against a Memcached server running at 127.0.0.1:11211. It is run on every opened pull request, but it is recommended to test locally beforehand. The easiest way to spin up the required Memcached server is to use Docker:

docker run --publish 127.0.0.1:11211:11211 memcached:1.5.17-alpine -v -v -v

After which you can execute the tests any number of times:

go test -v

About

go-memcachey is a Golang client library for the Memcached in-memory database.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages