Esempio 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()
}
Esempio n. 2
0
// Local uses the applications memory for storage.
func Local() Storage {
	return local.New()
}