MCPcopy
hub / github.com/dropbox/godropbox / clientExample

Function clientExample

memcache/example_test.go:44–216  ·  view source on GitHub ↗
(client memcache.Client)

Source from the content-addressed store, hash-verified

42}
43
44func clientExample(client memcache.Client) {
45 version := func() {
46 resp := client.Version()
47 fmt.Println("Version")
48 for i, v := range resp.Versions() {
49 fmt.Println(" Shard", i, "Version", v)
50 }
51 fmt.Println(" Status:", resp.Status())
52 if resp.Error() != nil {
53 fmt.Println(" Error:", resp.Error())
54 }
55 }
56
57 verbosity := func(v uint32) {
58 resp := client.Verbosity(v)
59 fmt.Println("Verbosity")
60 fmt.Println(" Status:", resp.Status())
61 if resp.Error() != nil {
62 fmt.Println(" Error:", resp.Error())
63 }
64 }
65
66 stats := func(key string) {
67 resp := client.Stat(key)
68 fmt.Println("Stats:", key)
69 for i, s := range resp.Entries() {
70 fmt.Println(" Shard", i)
71 for k, v := range s {
72 fmt.Println(" ", k, ":", v)
73 }
74 }
75 fmt.Println(" Status:", resp.Status())
76 if resp.Error() != nil {
77 fmt.Println(" Error:", resp.Error())
78 }
79 }
80
81 flush := func() {
82 resp := client.Flush(0)
83 fmt.Println("Flush")
84 fmt.Println(" Status:", resp.Status())
85 if resp.Error() != nil {
86 fmt.Println(" Error:", resp.Error())
87 }
88 }
89
90 get := func(key string) uint64 {
91 resp := client.Get(key)
92 fmt.Println("Get", resp.Key())
93 fmt.Println(" Status:", resp.Status())
94 fmt.Println(" Value:", string(resp.Value()))
95 fmt.Println(" Flags:", resp.Flags())
96 fmt.Println(" CasId:", resp.DataVersionId())
97 if resp.Error() != nil {
98 fmt.Println(" Error:", resp.Error())
99 }
100
101 return resp.DataVersionId()

Callers 3

ExampleRawBinaryClientFunction · 0.85
ExampleRawAsciiClientFunction · 0.85
ExampleShardedClientFunction · 0.85

Calls 15

VersionMethod · 0.65
VersionsMethod · 0.65
StatusMethod · 0.65
ErrorMethod · 0.65
VerbosityMethod · 0.65
StatMethod · 0.65
EntriesMethod · 0.65
FlushMethod · 0.65
GetMethod · 0.65
KeyMethod · 0.65
ValueMethod · 0.65
FlagsMethod · 0.65

Tested by

no test coverage detected