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

Interface Client

memcache/interface.go:128–247  ·  view source on GitHub ↗

NOTE(mihnea) - ideally we should be able to separate methods that are state-aware (i.e. GetSentinels / SetSentinels) away from this interface and into a new interface (e.g. StateAwareClient / ConsistentCachingClient). Such an interface should also have fewer methods (e.g. no Increment, Flush, etc.)

Source from the content-addressed store, hash-verified

126// interface (e.g. StateAwareClient / ConsistentCachingClient). Such an interface should also
127// have fewer methods (e.g. no Increment, Flush, etc.)
128type Client interface {
129 // This retrieves a single entry from memcache.
130 Get(key string) GetResponse
131
132 // Batch version of the Get method.
133 GetMulti(keys []string) map[string]GetResponse
134
135 // *** This method is specific to Dropbox zookeeper-managed memcache ***
136 // This is the same as GetMulti. The only difference is that GetMulti will
137 // only read from ACTIVE memcache shards, while GetSentinels will read from
138 // both ACTIVE and WRITE_ONLY memcache shards.
139 GetSentinels(keys []string) map[string]GetResponse
140
141 // This sets a single entry into memcache. If the item's data version id
142 // (aka CAS) is nonzero, the set operation can only succeed if the item
143 // exists in memcache and has a same data version id; otherwise, this will
144 // do an unconditional set.
145 Set(item *Item) MutateResponse
146
147 // Batch version of the Set method. Note that the response entries
148 // ordering is undefined (i.e., may not match the input ordering).
149 SetMulti(items []*Item) []MutateResponse
150
151 // *** This method is specific to Dropbox zookeeper-managed memcache ***
152 // This is the same as SetMulti. The only difference is that SetMulti will
153 // only write to ACTIVE memcache shards, while SetSentinels will write to
154 // both ACTIVE and WRITE_ONLY memcache shards.
155 SetSentinels(items []*Item) []MutateResponse
156
157 // Just like SetMulti, but if item's data version id (aka CAS) is zero,
158 // it will do a **conditional** add (will fail if the item already exists
159 // in memcache).
160 CasMulti(items []*Item) []MutateResponse
161
162 // *** This method is specific to Dropbox zookeeper-managed memcache ***
163 // This is the same as CasMulti. The only difference is that CasMulti will
164 // only write to ACTIVE memcache shards, while CasSentinels will write to
165 // both ACTIVE and WRITE_ONLY memcache shards.
166 CasSentinels(items []*Item) []MutateResponse
167
168 // This adds a single entry into memcache. Note: Add will fail if the
169 // item already exist in memcache.
170 Add(item *Item) MutateResponse
171
172 // Batch version of the Add method. Note that the response entries
173 // ordering is undefined (i.e., may not match the input ordering).
174 AddMulti(item []*Item) []MutateResponse
175
176 // This replaces a single entry in memcache. Note: Replace will fail if
177 // the does not exist in memcache.
178 Replace(item *Item) MutateResponse
179
180 // This delets a single entry from memcache.
181 Delete(key string) MutateResponse
182
183 // Batch version of the Delete method. Note that the response entries
184 // ordering is undefined (i.e., may not match the input ordering)
185 DeleteMulti(keys []string) []MutateResponse

Callers 89

TestGetNotFoundMethod · 0.65
TestGetBadKeyMethod · 0.65
GetAllShardsMethod · 0.65
clientExampleFunction · 0.65
GetMethod · 0.65
TestAddSimpleMethod · 0.65
TestGetMethod · 0.65
TestGetDupKeysMethod · 0.65
TestGetErrorMidStreamMethod · 0.65
TestGetMultiDupKeysMethod · 0.65

Implementers 4

MockClientmemcache/mock_client.go
RawBinaryClientmemcache/raw_binary_client.go
ShardedClientmemcache/sharded_client.go
RawAsciiClientmemcache/raw_ascii_client.go

Calls

no outgoing calls

Tested by

no test coverage detected