Пример #1
0
func TestMemcached(t *testing.T) {
	if len(hosts) < 1 {
		t.Skip("need memcache hosts to test")
	}

	k, v := "greeting", "Hello World"

	m := memcached.New(hosts)

	err := m.Put(k, []byte(v))

	if err != nil {
		t.Fatal(err.Error())
	}

	b := m.Get(k)

	if v != string(b) {
		t.Errorf("expected %s; got %s", v, b)
	}

	m.Flush()
}
Пример #2
0
// Memcache uses one or more Memcache hosts for storage.
func Memcached(hosts []string) Storage {
	return memcached.New(hosts)
}