Skip to content

Commit f4be948

Browse files
committed
docs: update example
1 parent ebedf04 commit f4be948

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

readme.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,18 @@ import (
4343
)
4444

4545
func main() {
46-
addr := "localhost:8500"
46+
ctx := context.Background()
4747

48-
// Initialize a new store.
4948
config := &redis.Config{
5049
Bucket: "example",
5150
}
5251

53-
kv, err := valkeyrie.NewStore(redis.StoreName, []string{addr}, config)
52+
kv, err := valkeyrie.NewStore(ctx, redis.StoreName, []string{"localhost:8500"}, config)
5453
if err != nil {
5554
log.Fatal("Cannot create store")
5655
}
5756

5857
key := "foo"
59-
ctx := context.Background()
6058

6159
err = kv.Put(ctx, key, []byte("bar"), nil)
6260
if err != nil {
@@ -68,11 +66,11 @@ func main() {
6866
log.Fatalf("Error trying accessing value at key: %v", key)
6967
}
7068

69+
log.Printf("value: %s", string(pair.Value))
70+
7171
err = kv.Delete(ctx, key)
7272
if err != nil {
7373
log.Fatalf("Error trying to delete key %v", key)
7474
}
75-
76-
log.Printf("value: %s", string(pair.Value))
7775
}
7876
```

0 commit comments

Comments
 (0)