Ejemplo n.º 1
0
func TestLocal(t *testing.T) {
	k, v := "greeting", []byte("Hello World")

	l := local.New()

	err := l.Put(k, v)

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

	b := l.Get(k)

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

	l.Delete(k)

	c := l.Get(k)

	if len(c) > 0 {
		t.Errorf("expected emtpy result; got %s", c)
	}

	l.Flush()
}
Ejemplo n.º 2
0
// Local uses the applications memory for storage.
func Local() Storage {
	return local.New()
}